A number theory problem by Aditya Moger

Find the last 4 digits of

201 7 201 7 2017 \large 2017^{2017^{2017}}


The answer is 3777.

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.

2 solutions

Marco Brezzi
Aug 13, 2017

The question translates to

x 201 7 201 7 2017 m o d 10000 0 x 9999 x\equiv 2017^{2017^{2017}} \mod{10000}\quad 0\leq x \leq 9999

And in case add some 0 0 s if x x is not a 4 4 -digit number

We will split in modulo 16 16 and modulo 625 625

x 201 7 201 7 2017 ( 126 16 + 1 ) 201 7 2017 1 201 7 2017 1 m o d 16 x\equiv 2017^{2017^{2017}} \equiv (126\cdot 16+1)^{2017^{2017}} \equiv 1^{2017^{2017}}\equiv 1\mod{16}

Now modulo 625 625 :

x 201 7 201 7 2017 ( 3 625 + 142 ) 201 7 2017 14 2 201 7 2017 m o d 625 x\equiv 2017^{2017^{2017}}\equiv (3\cdot 625 +142)^{2017^{2017}}\equiv 142^{2017^{2017}} \mod{625}

Now, using Euler's Theorem twice, with ϕ ( 625 ) = 500 \phi(625)=500 and ϕ ( ϕ ( 625 ) ) = 200 \phi(\phi(625))=200

x 14 2 201 7 2017 14 2 ( 4 500 + 17 ) 10 200 + 17 14 2 1 7 17 m o d 625 x\equiv 142^{2017^{2017}}\equiv 142^{(4\cdot 500+17)^{10\cdot 200+17}}\equiv 142^{17^{17}}\mod{625}

Now, there is not really an easy way to find y 1 7 17 m o d 500 y\equiv 17^{17}\mod{500} and then x 14 2 y m o d 625 x\equiv 142^y \mod{625} but I'll use as much shortcuts as I can

y 1 7 17 17 ( 1 7 4 ) 4 17 ( 83521 ) 4 17 2 1 4 17 194481 17 ( 19 ) 323 177 m o d 500 \begin{aligned} y&\equiv 17^{17}\\ &\equiv 17(17^4)^4\\ &\equiv 17(83521)^4\\ &\equiv 17\cdot 21^4\\ &\equiv 17\cdot 194481\equiv 17(-19)\equiv -323\equiv 177 \mod{500} \end{aligned}

Now we have x 14 2 177 m o d 625 x\equiv 142^{177} \mod{625}

x 14 2 177 142 ( 14 2 2 ) 88 142 ( 20164 ) 88 142 16 4 88 142 ( 16 4 2 ) 44 142 ( 26896 ) 44 142 2 1 44 142 ( 2 1 4 ) 11 142 19448 1 11 142 10 6 11 m o d 625 \begin{aligned} x&\equiv 142^{177}\\ &\equiv 142(142^2)^{88}\equiv 142(20164)^{88}\equiv 142\cdot 164^{88}\\ &\equiv 142(164^2)^{44}\equiv 142(26896)^{44}\equiv 142\cdot 21^{44}\\ &\equiv 142(21^4)^{11}\equiv 142\cdot 194481^{11}\equiv 142\cdot 106^{11} \mod{625} \end{aligned}

Now to find 10 6 11 m o d 625 106^{11}\mod{625} I'll use the Binomial Theorem

10 6 11 ( 100 + 6 ) 11 ( 11 0 ) 10 0 11 + ( 11 1 ) 10 0 10 6 + + ( 11 10 ) 100 6 10 + ( 11 11 ) 6 11 1100 6 10 + 6 11 m o d 625 \begin{aligned} 106^{11}&\equiv (100+6)^{11}\\ &\equiv \binom{11}{0}\cdot 100^{11}+\binom{11}{1}\cdot 100^{10}\cdot 6+\ldots +\binom{11}{10}\cdot 100\cdot 6^{10}+\binom{11}{11}\cdot 6^{11}\\ &\equiv 1100\cdot 6^{10}+6^{11} \mod{625} \end{aligned}

All the other terms vanished because they contained 4 4 or more factors of 5 5 , now

1100 6 10 + 6 11 1106 6 10 481 36 ( 6 4 ) 2 481 36 129 6 2 481 36 4 6 2 481 36 2116 481 36 241 17316 241 441 241 106281 31 m o d 625 \begin{aligned} 1100\cdot 6^{10}+6^{11}&\equiv 1106\cdot 6^{10}\\ &\equiv 481\cdot 36(6^4)^2\equiv 481\cdot 36\cdot 1296^2 \equiv 481 \cdot 36\cdot 46^2\\ &\equiv 481\cdot 36\cdot 2116\equiv 481\cdot 36\cdot 241\\ &\equiv 17316\cdot 241\equiv 441\cdot 241\equiv 106281 \equiv 31\mod{625} \end{aligned}

We are nearly done, x 142 31 4402 27 m o d 625 x\equiv 142\cdot 31 \equiv 4402\equiv 27 \mod{625}

We can now put things together using the CRT

{ x 1 m o d 16 x 27 m o d 625 \begin{cases} x\equiv 1 \mod{16}\\ x\equiv 27 \mod{625} \end{cases}

Since gcd ( 16 , 625 ) = 1 \gcd(16,625)=1 there is only one solution modulo 10000 10000 , namely

x 3777 m o d 10000 x\equiv \boxed{3777}\mod{10000}

Phenomenal solution :) You're one of my new favorite solution writers!

Zach Abueg - 3 years, 10 months ago

Log in to reply

Wow, thank you :)

Marco Brezzi - 3 years, 10 months ago
Aditya Moger
Aug 13, 2017

2017^2017 mod 10000 = 8177

But we need 2017^(2017^2017) mod 10000

Which is the same as...{by using euler's totient} 2017^8177 mod 10000

Which is.... 3777....

How did you get 8177 and 3777, respectively?

Pi Han Goh - 3 years, 10 months ago

Log in to reply

By solving dude. I didn't mention

Aditya Moger - 3 years, 10 months ago

Log in to reply

How did you solve it? Where did these numbers come from?

Pi Han Goh - 3 years, 10 months ago

Log in to reply

@Pi Han Goh 2017^2017 is congruent to 8177 mod 10000. And 2017^8177 is congruent to 3777 mod 10000.

Aditya Moger - 3 years, 9 months ago

Log in to reply

@Aditya Moger How did you compute these 2 numbers: 8177 and 3777?

Pi Han Goh - 3 years, 9 months ago

Log in to reply

@Pi Han Goh @Pi Han Goh - By using euler's totient

Aditya Moger - 3 years, 5 months ago

Log in to reply

@Aditya Moger That's not written in your solution. People who can't solve this question can't find your solution to be helpful.

Pi Han Goh - 3 years, 5 months ago

First of all, as Pi said, you didn't explain where you get those numbers, secondly congruences don't work like that, you can't say

a b a b m o d c m o d c a^b \equiv a^{b \mod{c}}\mod{c}

You can instead use Euler's Theorem

a b a b m o d ϕ ( c ) m o d c a^b\equiv a^{b \mod{\phi(c)}}\mod{c}

If and only if gcd ( a , c ) = 1 \gcd(a,c)=1

Marco Brezzi - 3 years, 10 months ago

Log in to reply

Then argue with David M Burton

Aditya Moger - 3 years, 10 months ago

Log in to reply

Who is David M Burton? Why do you need someone else to argue for you?

Pi Han Goh - 3 years, 10 months ago

Log in to reply

@Pi Han Goh You don't know who is David M Burton. He is a great mathematician and is the author of the book elementary number theory.

Aditya Moger - 3 years, 9 months ago

Log in to reply

@Aditya Moger How is he relevant to this discussion?

Pi Han Goh - 3 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...