2

Consider the sequence

$$ a_{1} = 1,\,\ a_{n+1} = n^{\large a_n},\,\ \ {\rm so}\,\ \ a_{2} = 2^{1},\,\ a_{3} = 3^{2^{\large 1}},\,\ a_{4} = 4^{\large 3^{2^{1}}} \qquad$$ How can we find the last two digits of $a_{23}?$

Bill Dubuque
  • 282,220
AgnostMystic
  • 1,808
  • One route which is certainly off-limits is to directly compute this. For instance, $a_5$ is already a number with more than 183000 digits. As such, even estimating the number of digits in $a_6$ likely not possible much less actually computing them. – Semiclassical Jul 16 '24 at 06:16
  • $n!>!0\Rightarrow e := 22^{21^n}!\equiv0\pmod{!4};:$ $!!\bmod 5!:\ e\equiv 2^{21^n\bmod 4}\equiv 2^1$, so $,e\equiv \color{darkorange}{12}\pmod{!20}.,$ $20=\phi(\color{#0af}{25}),,$ so mod $\color{#0af}{25}!:,$ $, 23^e \equiv (-2)^{\color{darkorange}{12}} \equiv 4096\equiv -4 \equiv \color{#c00}{21}.,$ But $,2\mid e,$ so $!\bmod \color{#0a0}4!:\ 23^e\equiv (-1)^e\equiv 1\equiv \color{#c00}{21},,$ so $,23^e\equiv \color{#c00}{21}\pmod{!\color{#0a0}4\cdot \color{#0af}{25}},$ by CCRT. Took one minute of mental arithmetic. – Bill Dubuque Jul 16 '24 at 23:25
  • This is a duplicate of many prior questions. Since it has just been closed for other reasons I will suspend my search for good dupe targets. If you have questions about the above (general) method then you may pose them in comments below. – Bill Dubuque Jul 16 '24 at 23:42

2 Answers2

0

This is about sequences of powers modulo $100$. We may check that the order of $23 \:(\text{mod }100)$ is $20$. The values of $23^n \:(\text{mod }100)$ for $n = 1$ to $20$ are:

$$23, 29, 67, 41, 43, 89, 47, 81, 63, 49, 27, 21, 83, 9, 7, 61, 3, 69, 87, 1$$

As $a_{23}$ is $23$ raised to the power of $22$ (and so on), it is then pertinent to ask about the order of $22 \:(\text{mod }20)$. This is only $4$, and, for $m>1$, $22^m \:(\text{mod }20)$ takes the values $$12, 4, 8, 16$$ according to whether the power $m \equiv 1, 2, 3, 4 \:(\text{mod }4)$.

We almost might go in circles if not for the fact that: $$ 21^k \equiv 1 \:(\text{mod }4) $$ for all $k \in \mathbb{N}$. Thus the power above $23$, namely $22^{21\dots}$, always ensures that the $1$st term of the $22$ sequence is selected, namely $\bf{12}$, and this ensures that the $12$th term of the $23$ sequence is selected, giving us $\bf{21}$ as the last two digits of $a_{23}$.

Sputnik
  • 3,887
  • We don't need the order (only any period length), nor do we need to brute-force compute all terms in a periodic cyle - see my comment on the question. Brute force enumeration would be infeasible for larger numbers, but the method I explained still works easily. – Bill Dubuque Jul 16 '24 at 23:46
  • Not sure my answer is the brutal one! I provided the answer I believed was at the level of the questioner. – Sputnik Jul 17 '24 at 08:52
  • The question contains no "level" context. The method I give in the comment uses only basic results of elementary number theory. – Bill Dubuque Jul 17 '24 at 15:39
-1

First thing to realise, is that the last digit is repeated after four times, as you can see in the following table:

$a$ $a^2$ $a^3$ $a^4$ $a^5$
$1$ $1$ $1$ $1$ $1$
$2$ $4$ $8$ $6$ $2$
$3$ $9$ $7$ $1$ $3$
$4$ $6$ $4$ $6$ $4$
$5$ $5$ $5$ $5$ $5$
$6$ $6$ $6$ $6$ $6$
$7$ $9$ $3$ $1$ $7$
$8$ $4$ $2$ $6$ $8$
$9$ $1$ $9$ $1$ $9$

$a_{23} = 23^{22^{...}} = 23^{4^{...} \cdot ...}$, so you can easily derive that the last digit will certainly be a one.
For the last but one digit, you just create a similar table until you find a repeating pattern and you continue from there.

Dominique
  • 3,267