## Consider all integer combinations of $a^b$ for $2 \le a \le 5$ and $2 \le b \le 5$:

\begin{matrix}

2^2=4, &2^3=8, &2^4=16, &2^5=32\\

3^2=9, &3^3=27, &3^4=81, &3^5=243\\

4^2=16, &4^3=64, &4^4=256, &4^5=1024\\

5^2=25, &5^3=125, &5^4=625, &5^5=3125

\end{matrix}

If they are then placed in numerical order, with any repeats removed, we get the following sequence of $15$ distinct terms:

$$4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125.$$

How many distinct terms are in the sequence generated by $a^b$ for $2 \le a \le 100$ and $2 \le b \le 100$?

### To calculate the number of distinct terms in the sequence generated by $a^b$ for $2 \le a \le 100$ and $2 \le b \le 100$, one should take into account that some numbers can be represented as powers of more than one base.

Firstly, consider that any integer $a$ in the range $2 \le a \le 100$ has $100 – 1 = 99$ integers $b$ in the range $2 \le b \le 100$. Therefore, if all combinations were distinct, there would be $100 – 2 = 98$ choices for $a$ times $99$ choices for $b$, or $98 \times 99 = 9702$ different numbers. However, not all of these numbers are distinct.

For instance, $4 = 2^2 = 2^2$, $8 = 2^3 = 2^3$, $16 = 2^4 = 4^2$, $32 = 2^5 = 2^5$, and $64 = 2^6 = 4^3$. In a more general view, this reflects the property $a^{mn} = (a^m)^n$, for positive integers $a$, $m$, and $n$.

To count the number of repeats, consider that any perfect square $a^2$ with $2 \le a \le 100$ can be written as $b^4$ for $b =\sqrt{a}$ greater or equal to $2$ (consider, for instance, $16 = 4^2 = 2^4$). Therefore, for the $10$ numbers $4 \le b \le 10$, there are $5$ possible pairs $(b, n)$: $(b, 4)$, $(b, 8)$, $(b, 12)$, $(b, 16)$, and $(b, 20)$.

Similarly, any perfect cube $a^3$ with $2 \le a \le 100$ can be written as $b^6$ for $b=\sqrt[3]{a}$ greater or equal to $2$ (consider, for instance, $64 = 4^3 = 2^6$) and there are $4$ such pairs $(b, n)$.

Similarly, any number of the form $a^5$ provides $2$ such pairs $(b, n)$, and any number of the form $a^6 = b^{12}$ provides $1$ such pair $(b, n)$.

If all these pairs were distinct, one should subtract the numbers of pairs, $10(5) + 9(4) + 8(2) + 7 = 98$ from the total $97 \times 99 = 9603$, yielding a result of $9505$. However, some of these pairs are not distinct either.

In fact, $2^4 = 4^2$, $2^6 = 4^3$, and $2^10 = 4^5$. Therefore, $3$ pairs, each appearing in two of the expressions, are counted twice. Subtracting $3$ from their total yields the final result:

$9505 – 3 = 9502$

There are $9502$ distinct terms in the sequence generated by $a^b$ for $2 \le a \le 100$ and $2 \le b \le 100$.

##### More Answers:

Reciprocal CyclesQuadratic Primes

Number Spiral Diagonals