n ¡ = n ( n − 1 ) ( n − 2 ) . . . 2 1
If n ¡ is defined as above, what are the last two digits of the number 2 0 1 8 ¡ ?
Note: ¡ is the factorial notation ! turned upside down. Note that ¡ keeps exponentiating while ! keeps multiplying.
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.
Yes, I did the same approach.
Last 2 digits of powers of 2018 will the same as for 18 and there will be a cycle (hopefully it's short.)
1 8 1 ends in 18
1 8 2 ends in 24
1 8 3 ends in 32
1 8 4 ends in 76
1 8 5 ends in 68
1 8 6 ends in 24 (same as 1 8 2 so the cycle is length 4.)
So where do powers of 2017 get us mod 4?
2017 is 1 mod 4. Nice! 1*1=1 so all powers of 2017 are 1 mod 4.
We just need the right spot on the list. It can't be the 18 because that one is unique. Advance 4 spaces to 68.
Sir could u pls explain why did u Advance 4 spaces to 68????
Log in to reply
The answer can't be 18 because only 18^1 ends in 18. Instead, because the cycle is of length 4, it's the last two digits of 18^5.
The phrasing is really weird about advancing. Here's how I understand it:
If it's a cycle of 4 and 0 mod 4, then no problem the last 2 digits will be the 4th in the cycle. But this sequence starts with 18 which isn't repested, so if it's 0mod 4 it should always be the 3rd. However since it's 1 mod 4, you have to move forward 1 more, meaning you end up at the 4th one.
To illustrate, let's say the cycle is only 24 32 76 68(no 18). If it's 0mod 4 then answer is 68. But since first number is 18, and it is not in the cycle, 0 mod 4 will be 76 instead. Thus 1 mod 4 will be 68
We want to find a x such that x ≡ 2 0 1 8 ¡ ( m o d 1 0 0 ) .
This is equivalent to finding the unique 0 ≤ x < 1 0 0 such that x ≡ 2 0 1 8 ¡ ( m o d 4 ) x ≡ 2 0 1 8 ¡ ( m o d 2 5 )
The first equivalence is easy to solve, as clearly, 2 0 1 8 ¡ is divisible by 4 , so x ≡ 0 ( m o d 4 ) .
Consider the second equivalence: x ≡ 2 0 1 8 ¡ ≡ 2 0 1 8 2 0 1 7 2 0 1 6 . . . 2 1 ≡ 1 8 2 0 1 7 2 0 1 6 . . . 2 1 ( m o d 2 5 )
Note that 2 0 1 7 ≡ 1 ( m o d 4 ) and 1 8 4 ≡ ( − 7 ) 4 ≡ ( − 1 ) 2 ≡ 1 ( m o d 2 5 ) . Thus, for a certain integer k , x ≡ 1 8 4 k + 1 ≡ 1 8 4 k ⋅ 1 8 1 ≡ 1 8 ( m o d 2 5 )
Thus, we're finding x ≡ 0 ( m o d 4 ) x ≡ 1 8 ( m o d 2 5 )
By the Chinese Remainder Theorem, such a 0 ≤ x < 1 0 0 exists and is unique. By trial-and-error, we find that x = 6 8 .
Can you please explain the second step when you reduce (mod 100) to (mod 4) and (mod 25)? I understood the rest of it....
Log in to reply
If we're given a ≡ b ( m o d m n ) , where m and n are coprime integers, then a ≡ b ( m o d m ) a ≡ b ( m o d n )
.#include <iostream> .#include <conio.h> //without dots in the beginning
using namespace std;
int powe(int arg, int power) { int result = 1; if (arg > 99) { while (arg > 99) arg = arg - 100; } while (power > 0) { result = result * arg; if (result > 99) { while (result > 99) result = result - 100; } power--; } return result; }
int main() { int n; cin >> n; int result = n; while (n > 1) { result = powe(result, n - 1); n--; } cout << result; _getch(); return 0; }
//n = 2018 result = 76 //c++
Log in to reply
I think you've been a bit lucky with the result here (there are only four values for the last two digits so it's not too surprising). You've calculated ((2018^2017)^2016)^... = 2018^(2017!). You needed to calculate 2018^(2017^(2016^...)) instead, which is not so easy.
Also, you could simplify your program. For example, you can replace
result = result * arg; if (result > 99) { while (result > 99) result = result - 100;
with
result = (result * arg)%100
Just as a general point too, you don't need something like if(x){while(x) ...}. If x is false, then you would skip the while loop anyway so just while(x) ... is sufficient.
@Nick Turtle Can you tell me how to use the factorial notation turned in LaTeX?
Reduce!
Take note that 1 0 n ≡ 0 ( mod 1 0 0 ) if n is an integer greater than 2.
Similar to the fact that k ! ≡ 0 ( mod 1 0 0 ) if k is greater than or equal to 10, the entire expression, when working from the top to the bottom, hits reset when the expression hits every multiple of ten.
For example.
1 0 9 etc ≡ 1 0 0 9 9 etc ≡ 1 0 0 0 9 9 9 etc ≡ 0 ( mod 1 0 0 )
This is true because 1 1 n ≡ 0 ( mod 1 0 0 ) for every n that is multiple by then, therefore the reset works every time and does not get broken.
Thus,
2 0 1 8 2 0 1 7 etc ≡ 1 8 1 7 etc ( mod 1 0 0 ) .
Now, it should be easy to solve this.
1 8 1 ≡ 1 8 ( mod 1 0 0 )
1 8 2 ≡ 2 4 ( mod 1 0 0 )
1 8 3 ≡ 3 2 ( mod 1 0 0 )
1 8 4 ≡ 7 6 ( mod 1 0 0 )
1 8 5 ≡ 6 8 ( mod 1 0 0 )
1 8 6 ≡ 2 4 ( mod 1 0 0 )
Take note that the cycle length is four but the starting point of the cycle is 24.
Now let us figure out what is 1 7 1 6 etc ( mod 4 ) . Luckily, 1 7 ≡ 1 ( mod 4 ) , thus, 1 7 1 6 etc ≡ 1 ( mod 4 )
Since the starting point of the cycle is the second number, we subtract from 2 from 1 and we get 1 − 2 = − 1 ≡ 3 ( mod 4 ) .
Therefore the remainder is the 3rd position from the starting point 24.
And we now have our answer. 2 0 1 8 2 0 1 7 etc ≡ 6 8 ( mod 1 0 0 ) .
P.S. Forgive me for the incomplete nested exponents for I do not know how to stack more than two exponents. But you get the idea, right? Give me advice in the comment section if you have a solution to my naivete.)
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: Euler's Theorem
Let N = 2 0 1 8 ¡ . We need to find N m o d 1 0 0 . Since 2018 and 100 are not coprime integers, we have to consider the factors 4 and 25 of 100 separately using Chinese remainder theorem .
Consider factor 4 : N ≡ 0 (mod 4) .
Consider factor 25 :
N ≡ 2 0 1 8 2 0 1 7 a m o d ϕ ( 2 5 ) (mod 25) ≡ 2 0 1 8 2 0 1 7 a m o d 2 0 (mod 25) ≡ 2 0 1 8 2 0 1 7 2 0 1 6 b m o d ϕ ( 2 0 ) m o d 2 0 (mod 25) ≡ 2 0 1 8 2 0 1 7 2 0 1 6 b m o d 8 m o d 2 0 (mod 25) ≡ 2 0 1 8 2 0 1 7 0 m o d 2 0 (mod 25) ≡ 2 0 1 8 1 (mod 25) ≡ 1 8 (mod 25) Since g cd ( 2 0 1 8 , 2 5 ) = 1 , Euler’s theorem applies. Euler’s totient function ϕ ( 2 5 ) = 2 0 Again g cd ( 2 0 1 7 , 2 0 ) = 1 , Euler’s theorem applies. Euler’s totient function ϕ ( 2 0 ) = 8
Therefore, we have:
⟹ N 2 5 n + 1 8 n + 2 ⟹ n ⟹ N ≡ 2 5 n + 1 8 ≡ 0 (mod 4) ≡ 0 (mod 4) ≡ 2 (mod 4) ≡ 2 5 ( 2 ) + 1 8 (mod 100) ≡ 6 8 (mod 100) where n is an integer.