.d9n.
- 60
- 0
Homework Statement
Given integers a and n, where n > 0, how many multiplications
are needed to calculate a^n? You are not expected to produce a
precise answer, but if n is a million it should become clear from
your answer that 40 multiplications will suffice.
Homework Equations
The Attempt at a Solution
y=a^n so n=log_a(y)
so if n=1000000
n=1000000=log_a(y)=
or
y=e^(nlog(a))=e^(1000000log(a))
not sure how I'm meant to do this, as far as i am (aware/ can find) there isn't a relationship between a and n that could do it to 40 multiplications as this would mean you have to knwo a^25 000 and then maybe multiply this by 40, but I am pretty sure that's wrong.
any ideas on where to look?