Calculate a^n, if n=1000000 then it should be calculated in 40 multiplications

  • Thread starter Thread starter .d9n.
  • Start date Start date
Click For Summary

Homework Help Overview

The problem involves calculating the number of multiplications required to compute \( a^n \) for large values of \( n \), specifically when \( n = 1000000 \). The context suggests that the goal is to achieve this in a minimal number of multiplications, ideally around 40.

Discussion Character

  • Exploratory, Mathematical reasoning

Approaches and Questions Raised

  • Participants discuss the relationship between \( a \) and \( n \), exploring logarithmic expressions and the implications of calculating powers through multiplication. There is an attempt to understand how to reduce the number of multiplications needed for large exponents.

Discussion Status

The discussion is ongoing, with participants sharing different methods of calculating powers and questioning the efficiency of their approaches. Some guidance has been offered regarding the reuse of previously calculated powers, but no consensus has been reached on a specific method to achieve the desired number of multiplications.

Contextual Notes

Participants are operating under the assumption that \( n \) is significantly large, and there is an emphasis on finding a method that minimizes the number of multiplications. The original poster expresses uncertainty about the relationships necessary to achieve the goal.

.d9n.
Messages
60
Reaction score
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?
 
Physics news on Phys.org
Calculate a4 in 2 multiplications and it should be clear how to proceed
 
so by two multiplications do you mean
a^2 x a^2
so for the qu you mean
a^25000 x a^25000 x ... x a^25000 - 40 times

say n=1000000

is this what you mean

a^1000000=a^500000 x a^500000 =a^ (a^25000)^20 x (a^25000)^20 = (a^25000)^40

or

a^2^500000= a^2^2^250000 = a^2^2^2^125000 = a^2^2^2^2^62500 = a^2^2^2^2^2^31250 ...
or neither
 
a6 in three multiplications:

First multiplication:
$$a\times a=a^2$$

Second multiplication:
$$a\times a^2 = a^3$$

Third multiplication:
$$a^3\times a^2=a^6$$

Idea is to reuse what you already calculated earlier.
 

Similar threads

Replies
3
Views
2K
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 23 ·
Replies
23
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 26 ·
Replies
26
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
2
Views
5K