Download M(n)

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Theorem wikipedia , lookup

Collatz conjecture wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Location arithmetic wikipedia , lookup

Arithmetic wikipedia , lookup

Addition wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
Binary Method
Repeated Squaring Method
Repeated Doubling Method
Phase I
(Repeated Doubling)
For log2 n stages:
Add largest so far to itself
(1, 2, 4, 8, 16, . . . )
Phase II
(Make n from bits and pieces)
Expand n in binary to see how n is the sum
of Bn powers of 2. Use Bn-1 stages to make
from the powers of 2 created in phase I
Total Cost:
n
log2 n  Bn  1