# What is the remainder when $7^{7^{7^{7…Infinity }}}$ is divided by $5$? [closed]

What is the remainder when $7^{7^{7^{7.........Infinity }}}$ is divided by $5$ ?

My try :

$7^7$ when divided by $5$ gives the remainder $3$,and

similarly, $7^{7^7}$ when divided by $5$ again gives the remainder $3$,and

so, i know that upto infinity it will give remainder $3$.

But, Above approach does not shows any real Maths. How to approach for such questions ?

Edit :

Can I stop the power tower to something like $7^{4k + R}$ ?

## closed as unclear what you're asking by Cameron Williams, Winther, C. Falcon, Adam Hughes, user91500Jan 1 '17 at 9:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• The remainder is defined when you divide a natural number $n$ to a natural number $m$. However, $7^{7^{7^{7^{...}}}}$ is not a natural number. – Levent Dec 31 '16 at 18:16
• As @Levent says, you can continue the "power tower" as far up as you want, but it has to stop somewhere. – Arthur Dec 31 '16 at 18:18
• If I power something ending with "1" infinite times I am pretty sure it will still have "1" on the end – Markoff Chainz Dec 31 '16 at 18:21
• "Above approach does not shows any real Maths. How to approach for such questions ?" Note that $(x_n)$ defined by $x_0=7$ and $x_{n+1}=7^{x_n}$ is such that $x_n=3\bmod{5}$ for every $n\geqslant1$. Now you have a precise mathematical statement, which you will know how to prove, and which involves no undefined operation and/or quantity. – Did Dec 31 '16 at 18:22
• Try to power $11$ infinite times. Is it still ending with $1$? – Levent Dec 31 '16 at 18:23

$7^1\equiv2\pmod5$

$7^2\equiv4\pmod5$

$7^3\equiv3\pmod5$

$7^4\equiv1\pmod5$

Thus,

$7^n=7^{4k+(n\mod4)}=(7^4)^k\times7^{n\mod4}\equiv1^k\times7^{n\mod4}=7^{n\mod4}\pmod5$

Via similar reasoning,

$7^n=7^{2k+(n\mod2)}=(7^2)^k\times7^{n\mod2}\equiv1^k\times7^{n\mod2}=7^{n\mod2}\pmod4$

Finally,

$$7^{7^{7^n}}\equiv7^{(7^{(7^n\mod2)}\mod4)}=7^3\equiv3\pmod5$$

• The "Thus" is a big gap that deserves to be filled (esp. at this level). – Bill Dubuque Dec 31 '16 at 19:09
• @BillDubuque It appears the OP understood just fine though. – Simply Beautiful Art Dec 31 '16 at 21:35
• How do you know that? Acceptance of an answee certainly does not imply that the OP is aware of the gap, or knows how to fix it. – Bill Dubuque Dec 31 '16 at 21:57
• @BillDubuque Does it look better now? – Simply Beautiful Art Dec 31 '16 at 22:13
• Yes, that fills the gap. – Bill Dubuque Dec 31 '16 at 22:20

First off, notice that "$7^{7^{\cdots\infty}}$" is not a number - what does it mean to evaluate an infinite power tower?

What I think you mean is most easily expressed using the operation of tetration. Let $^n7$ denote a length-$n$ power tower of $7$s (so $^37 = 7^{7^7}$). Then the question seems to be "what is the remainder of $^n7$ when divided by $5$, for any $n$?"

My other concern is with your argument - two examples does not a proof make. I could similarly argue "$3$ is prime, $5$ is prime, therefore every odd number is prime". What you want to do is use induction: show that if $^n7$ has remainder $3$ when divided by $5$, then so does $^{n+1}7$. That's actually pretty easy - an answer posted while I was typing this gave a good explanation. But once you have that argument, and the fact that $^27 = 7^7$ works, you now know that $^n7$ has remainder $3$ for every $n > 1$.

$7\equiv 2 \bmod 5$

$2^x \equiv 2^{x \bmod \phi(5)} \bmod 5$

$2^x \equiv 2^{x \bmod 4} \bmod 5$

$7 \equiv 3\bmod 4$

$3^x \equiv -1^{x} \equiv -1^{x\bmod 2} \bmod 4$

$7^{\text{anything}} \equiv 1 \bmod 2$

$7^{7^{\text{anything}}} \equiv 3^{7^{\text{anything}}} \equiv 3 \bmod 4$

$7^{7^{7^{\text{anything}}}} \equiv 2^{3^{7^{\text{anything}}}} \equiv 2^{3} \equiv 3 \bmod 5$

let $a_1=7$ and let $a_{n+1}=7^{a_n}$. It is clear that $a_n\equiv 3 \bmod 4$ because $7$ is congruent to $3\bmod 4$, and we are raising this number to an odd exponent.

Therefore, by fermats theorem we have $7^{a_n}\equiv 7^3\equiv 3 \bmod 5$.

So $a_n\equiv 3\bmod 5$ for $n>1$.

• ?? $a_2=823543$. – Did Dec 31 '16 at 18:27
• @Did yeah, there was a typo in the last line, thank you kindly. – Jorge Fernández Hidalgo Dec 31 '16 at 18:29

${\rm mod}\,\ \color{#c00}4\!:\,\ \color{#0a0}{7^{\large K}}\!\equiv (-1)^{\large K}\!\equiv\, \color{#c00}{\pm 1},\$ i.e. $\,+1$ for even $K;\,$ $\,-1\,$ for odd $K.\,$ Therefore

${\rm mod}\,\ 5\!:\ 7^{\Large\color{#0a0}{7^{\LARGE K}}}\!\!\!\equiv 2^{\large\color{#c00}{\pm1+4N}}\!\equiv 2^{\large \pm1} {\underbrace{(2^{\large 4})}_{\large \equiv\: 1\ }}^{\!\large N}\!\!\equiv 2^{\large \pm1}\!\equiv \pm 2,\$ i.e. $\, 2\,$ for even $K;\,$ $-2\,$ for odd $K$ (OP)