My first problem

T m = 1 7 1 7 17 m times \large{T_m=\underbrace{17^{17^{\cdot^{\cdot^{\cdot^{17}}}}}}_{m \text{ times}}}

Find the smallest possible value of n n such that the numbers T n , T n + 1 , T n + 2 , T_n,T_{n+1},T_{n+2},\ldots all have the same last (rightmost) 2017 digits.


Bonus: Generalize to the last k k digits.


The answer is 2017.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Mark Hennings
Aug 20, 2017

Let p p be an odd prime, and let g g be a positive integer which is a primitive root modulo p p , and such that g p 1 ≢ 1 ( m o d p 2 ) g^{p-1} \not\equiv 1 \pmod{p^2} .

CLAIM 1 Then g ϕ ( p k ) ≢ 1 ( m o d p k + 1 ) g^{\phi(p^k)} \not\equiv 1 \pmod{p^{k+1}} for all k 1 k \ge 1 .

This is proved by induction. The case k = 1 k=1 is given. Suppose that k 1 k \ge 1 . If g ϕ ( p k ) ≢ 1 ( m o d p k + 1 ) g^{\phi(p^k)} \not\equiv 1 \pmod{p^{k+1}} then it follows that g ϕ ( p k ) = 1 + u p k g^{\phi(p^k)} = 1 + up^k where p p does not divide u u . Since ϕ ( p k + 1 ) = p ϕ ( p k ) \phi(p^{k+1}) = p\phi(p^k) , we deduce that g ϕ ( p k + 1 ) = ( 1 + u p k ) p 1 + u p k + 1 ( m o d p k + 2 ) g^{\phi(p^{k+1})} \; = \; (1 + up^k)^p \; \equiv \; 1 + up^{k+1} \pmod{p^{k+2}} and hence g ϕ ( p k + 1 ) ≢ 1 ( m o d p k + 2 ) g^{\phi(p^{k+1})} \not\equiv 1 \pmod{p^{k+2}} . The result follows by induction.

CLAIM 2 Then g g is a primitive root modulo p k p^k for all k 1 k \ge 1 .

The case k = 1 k=1 is given. Suppose now that k 1 k \ge 1 and that the order of g g modulo p k p^k is ϕ ( p k ) \phi(p^k) . Let x x be the order of g g modulo p k + 1 p^{k+1} . Then g x 1 ( m o d p k + 1 ) g^x \equiv 1 \pmod{p^{k+1}} , and so g x 1 ( m o d p k ) g^x \equiv 1 \pmod{p^k} , so that ϕ ( p k \phi(p^k ) divides x x . On the other hand x x must divide ϕ ( p k + 1 ) = p ϕ ( p k ) \phi(p^{k+1}) = p\phi(p^k) . From Claim 1 we know that x ϕ ( p k ) x \neq \phi(p^k) , and hence we deduce that x = ϕ ( p k + 1 ) x = \phi(p^{k+1}) . The result follows by induction.

It is now a simple calculation to show that g = 17 g=17 and p = 5 p=5 satisfy these conditions, so that 17 17 is a primitive root modulo 5 k 5^k for all k 1 k\ge 1 .

Note that T 1 T 0 = 16 = 2 4 T_1 - T_0 = 16 = 2^4 . Suppose that T k + 1 T k ( m o d 2 k + 4 ) T_{k+1} \equiv T_k \pmod{2^{k+4}} . Then T k + 1 T k ( m o d ϕ ( 2 k + 5 ) ) T_{k+1} \equiv T_k \pmod{\phi(2^{k+5})} , and hence T k + 2 = 1 7 T k + 1 1 7 T k = T k + 1 ( m o d 2 k + 5 ) T_{k+2} = 17^{T_{k+1}} \equiv 17^{T_k} = T_{k+1} \pmod{2^{k+5}} . Thus we deduce by induction that T k + 1 T k ( m o d 2 k + 4 ) T_{k+1} \equiv T_k \pmod{2^{k+4}} for all k 0 k \ge 0 .

Suppose that T k + 1 T k ( m o d 4 × 5 k ) T_{k+1} \equiv T_k \pmod{4 \times 5^k} . Then T k + 1 T k ( m o d ϕ ( 5 k + 1 ) ) T_{k+1} \equiv T_k \pmod{\phi(5^{k+1})} , and hence T k + 2 = 1 7 T k + 1 1 7 T k = T k + 1 ( m o d 5 k + 1 ) T_{k+2} = 17^{T_{k+1}} \equiv 17^{T_k} = T_{k+1} \pmod{5^{k+1}} . Since T k + 2 T k + 1 1 ( m o d 4 ) T_{k+2} \equiv T_{k+1} \equiv 1 \pmod{4} , we deduce that T k + 2 T k + 1 ( m o d 4 × 5 k + 1 ) T_{k+2} \equiv T_{k+1} \pmod{4 \times 5^{k+1}} . Since the ground step is trivial, we have shown by induction that T k + 1 T k ( m o d 4 × 5 k ) T_{k+1} \equiv T_k \pmod{4\times5^k} for all k 0 k\ge0 .

Thus we deduce that T k + 1 T k ( m o d 1 0 k ) T_{k+1} \equiv T_k \pmod{10^k} for all k 0 k \ge 0 , and hence that T k T 2017 ( m o d 1 0 2017 ) T_k \equiv T_{2017} \pmod{10^{2017}} for all k 2017 k \ge 2017 .


Suppose it was true that T 2017 T 2016 ( m o d 1 0 2017 ) T_{2017} \equiv T_{2016} \pmod{10^{2017}} . Then we know that T 2017 T 2016 ( m o d 5 2017 ) T_{2017} \equiv T_{2016} \pmod{5^{2017}} , and so 1 7 T 2016 1 7 T 2015 ( m o d 5 2017 ) 17^{T_{2016}} \equiv 17^{T_{2015}} \pmod{5^{2017}} . Since 17 17 is a primitive root modulo 5 2017 5^{2017} , we deduce that T 2016 T 2015 ( m o d ϕ ( 5 2017 ) ) T_{2016} \equiv T_{2015} \pmod{\phi(5^{2017})} , and hence T 2016 T 2015 ( m o d 5 2016 ) T_{2016} \equiv T_{2015} \pmod{5^{2016}} . This in turn would imply that T 2015 T 2014 ( m o d 5 2015 ) T_{2015} \equiv T_{2014} \pmod{5^{2015}} , and so T 2014 T 2013 ( m o d 5 2014 ) T_{2014} \equiv T_{2013} \pmod{5^{2014}} . Continuing down inductively, we deduce that T 1 T 0 ( m o d 5 ) T_1 \equiv T_0 \pmod{5} , which is not true. Thus it is not the case that T 2017 T 2016 ( m o d 1 0 2017 ) T_{2017} \equiv T_{2016} \pmod{10^{2017}} , and so the answer to the question is 2017 \boxed{2017} .

More generally, the smallest integer n n such that T m T n ( m o d 1 0 k ) T_m \equiv T_n \pmod{10^k} for all m n m \ge n is k \boxed{k} .

Wow, I surely wouldn't ever come up with such a solution. May I ask you where you learned this advanced (to me) modular arithmetic or am I still too young for it?

Marco Brezzi - 3 years, 9 months ago

Log in to reply

Well I learned this at university. Primitive roots modulo prime powers are a topic often left out of elementary textbooks on number theory (or come right at the end), but there is plenty out there on the Internet to be found. There is quite a discussion on the Internet, on MSE at the like, about power towers (which this question is all about).

Mark Hennings - 3 years, 9 months ago

Log in to reply

Ok, thank you

Marco Brezzi - 3 years, 9 months ago

Awesome and complete formal solution.

Mr X - 3 years, 9 months ago
Ngoc Nguyen
Aug 24, 2017

You can actually guess solution with Excel! Not a proof but a quick guess within 5min!

First for k = 2: Create and index column from 1 to 100 (10^k), another column to find mod(17^k,100) (You can avoid large number by referring the previous mod). Notice that at 17^100 mod 100 = 1. So look for the last 2 digit for 1 7 17 17^{17} , it's 77. Therefore 1 7 1 7 17 m o d 100 = 1 7 77 m o d 100 17^{17^{17}} \mod 100 = 17^{77} \mod 100 , which is 77! So at n=2, the circles begins!

Repeat for k =3: Same discovery: When we exponentiate 17 with a power with the last digits "777", we will get a number with the last digits "777" => n=3

See the pattern?

Marco Brezzi
Aug 9, 2017

Note: This solution is incorrect. Can you spot the error?


Generalization \textbf{Generalization}

I'll define ϕ m ( t ) \phi^m(t) as follows for later use

ϕ m ( t ) = ϕ ( ϕ ( ϕ ( t ) ) ) m c t i m e s \phi^m(t)=\underbrace{\phi(\phi(\dots\phi(t)\dots))}_{m\phantom{c} times}

Where ϕ \phi is Euler's Totient Function

First Case: \textbf{First Case:} k = 1 k=1

The smallest n n is 1 1 because, since ϕ ( 10 ) = 4 \phi(10)=4

T a = 17 17 . . . 17 a 7 1 . . . 17 a 7 m o d 10 T_a=\underbrace{\mathbin{\color{#D61F06}17}^{\mathbin{\color{#3D99F6}17}^{.^{.^{.^{17}}}}}}_{a}\equiv \underbrace{\mathbin{\color{#D61F06}7}^{\mathbin{\color{#3D99F6}1}^{.^{.^{.^{17}}}}}}_{a}\equiv 7 \mod 10

Second Case: \textbf{Second Case:} k = 2 k=2

The smallest n n is 2 2 , in a similar way, since ϕ 2 ( 100 ) = 16 \phi^2(100)=16

T a = 1 7 1 7 17 . . . 17 a 1 7 1 7 1 . . . 17 a 1 7 17 m o d 100 T_a=\underbrace{17^{17^{\mathbin{\color{#D61F06}17}^{.^{.^{.^{17}}}}}}}_{a}\equiv \underbrace{17^{17^{\mathbin{\color{#D61F06}1}^{.^{.^{.^{17}}}}}}}_{a}\equiv 17^{17} \mod 100

General Case: \textbf{General Case:} k 3 k\geq 3

We will evaluate the remainders m o d 2 k \mod 2^k and m o d 5 k \mod 5^k and then combine using the CRT . We have to find the smallest m 1 , m 2 m_1,m_2 such that 17 1 m o d ϕ m 1 ( 2 k ) 17\equiv 1 \mod \phi^{m_1}(2^k) and 17 1 m o d ϕ m 2 ( 5 k ) 17\equiv 1 \mod \phi^{m_2}(5^k) and then consider the biggest of the two. This is because this generates a 1 1 in the tower, so that even if we add more 17 17 to it, the remainder won't change

If k = 3 k=3 or k = 4 k=4 , T a T_a always leaves a remainder of 1 m o d 2 k 1 \mod 2^k .

If k > 4 k>4 , we have that ϕ k 4 ( 2 k ) = ( 1 2 ) k 4 2 k = 2 4 = 16 \phi^{k-4}(2^k)=\left(\dfrac{1}{2}\right)^{k-4}\cdot 2^k= 2^4=16

and 17 1 m o d 16 17\equiv 1\mod 16 , so the minimal n n is at least k 4 k-4 , let's check what happens m o d 5 k \mod 5^k

ϕ k ( 5 k ) = 4 5 ( 2 5 ) k 1 5 k = 2 k + 1 \phi^k(5^k)=\dfrac{4}{5}\left(\dfrac{2}{5}\right)^{k-1}\cdot 5^k=2^{k+1}

ϕ 2 k 3 ( 5 k ) = ϕ k 3 ( ϕ k ( 5 k ) ) = ϕ k 3 ( 2 k + 1 ) = ( 1 2 ) k 3 2 k + 1 = 2 4 = 16 \phi^{2k-3}(5^k)=\phi^{k-3}(\phi^k(5^k))=\phi^{k-3}(2^{k+1})=\left(\dfrac{1}{2}\right)^{k-3}\cdot 2^{k+1}=2^4=16

And again, 17 1 m o d 16 17\equiv 1\mod 16 , so the minimal n n is at least 2 k 3 2k-3

Since n 3 n\geq 3 , 2 k 3 > k 4 2k-3>k-4 so the answer is 2 k 3 \boxed{2k-3}

In this particular case we have k = 2017 k=2017

n m i n = 2 2017 3 = 4031 \Longrightarrow n_{min}=2\cdot 2017 - 3 = \boxed{4031}

FYI You should define terms / variables before using them. It is hard to phrase what your first case is, and I only understood when I looked at the general case.

Calvin Lin Staff - 3 years, 9 months ago

Here are the first 307 stable digits. We need to raise 17 to the power of 17 only 307 times The formula you developed is not minimal as I reported In fact, the logic used in the proof gives a bound to n but not the smallest value.

5107279372967984947900403975982049411742453302121449749395881706714897057361015870062793953395075122582350464052141094476381289780976882251792367786482612939220805814970195274745695085455170303734459544289785840831572423723078836315718561614186788278078398467943619327051293165692847290823289107359720085777

I may give the 2017 digits later

Mr X - 3 years, 9 months ago

Log in to reply

To confirm, you believe the answer is 307?

I agree with your report that 4031 satisfies the conditions, but it is most likely not the minimum.

Calvin Lin Staff - 3 years, 9 months ago

Log in to reply

For 307 the answer happens to be 307 I suspect the answer will be 2017 for the case of 2017

I didn't prove it formally. This is the result of computer calculations. I need to resolve an overflow problem for greater values bigger than 307

Mr X - 3 years, 9 months ago

Log in to reply

@Mr X Ah, I see that's what you mean.

Good luck resolving the overflow. Keep me updated :)

Calvin Lin Staff - 3 years, 9 months ago

Log in to reply

@Calvin Lin It is formal. The answer is 2017. Proved formally and calculated by computer The first 2017 digits are stable when n=2017 and NOT 4031

9043916840750404329173256208781505940564043118000462361983775912634826012242383635262875767008723337708536739594089475445559723246674687894534878718275386925214720216977233791511710277333434566292668280317915314472466961493204395934292136340205799477244823788140753553187743788502308933332512007070743665143677877548116818556373410930740448680041016813976825443200548664330251325654504983618885553317166221688446171703290790514810141650839637025433762696682516149739376715546273123246552299531884355981650740539426456001111105911855218595437287919121769751374522521501876013136095591734524896245116651752348091540736598281955696172189784686219907369981962399400423004752831651050633809517975754401462099942101561837321920775644499073834391653326144003220443936752431791804173878603088096971916972995420626590228626977322099599121073776753894169103331829852440399871102214942633875477880470215162010231498823688972783979673953200762156952043010533451479053590280410007130178893897229506922212464560876255639146869261619559924860903149576944017179639059832230504077025785521216964889264242553448625928108115887505739993837972692752678029759140647409187488671411040451830616070710533902142608341342619668393366408843763976427312525244850378491629440651604743250041076884901469064277364166761809976916499451988412331094083977236121957706141590263608967097535618856861582457457367339001278800838484157264627400713671451466963945049793958981940414533875588312725489135199985915515078149752117497228781501767197084117944346748499921882170798272438665456293599103543280116218306515397605933904886310934825969137448605302465022513653210649062419035014657782117747528205488554897233379628123708393240747233152439259704245107279372967984947900403975982049411742453302121449749395881706714897057361015870062793953395075122582350464052141094476381289780976882251792367786482612939220805814970195274745695085455170303734459544289785840831572423723078836315718561614186788278078398467943619327051293165692847290823289107359720085777

Mr X - 3 years, 9 months ago

Log in to reply

@Mr X @Calvin Lin See my proof.

Mark Hennings - 3 years, 9 months ago

There is another admin of the page who marked the report as resolved. I will not report it again but the answer is 2017 and not 4031

Mr X - 3 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...