Three-peat

Find the last two digits of ( n = 1 33 n ! ) 33 \displaystyle\large\left(\sum_{n=1}^{33} n!\right)^{33} .


Inspired by Md Zuhair and Kushal Bose


The answer is 53.

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.

6 solutions

Note first that finding the last two digits of an integer N N is equivalent to finding N ( m o d 100 ) N \pmod{100} . Also,

( n = 1 33 n ! ) 33 ( m o d 100 ) ( ( n = 1 33 n ! ) ( m o d 100 ) ) 33 ( m o d 100 ) \displaystyle\left(\sum_{n=1}^{33} n! \right)^{33} \pmod{100} \equiv \left(\left(\sum_{n=1}^{33} n! \right) \pmod{100}\right)^{33} \pmod{100} \equiv

( n = 1 33 ( n ! ( m o d 100 ) ) ) 33 ( m o d 100 ) \displaystyle\left(\sum_{n=1}^{33} (n! \pmod{100}) \right)^{33} \pmod{100} .

Now for n 10 n \ge 10 we have that 2 5 10 = 100 n ! 2*5*10 = 100 | n! , and thus n ! ( m o d 100 ) = 0 n! \pmod{100} = 0 for n 10 n \ge 10 . Thus

n = 1 33 ( n ! ( m o d 100 ) ) ( m o d 100 ) n = 1 9 ( n ! ( m o d 100 ) ) ( m o d 100 ) \displaystyle\sum_{n=1}^{33} (n! \pmod{100}) \pmod{100} \equiv \sum_{n=1}^{9} (n! \pmod{100}) \pmod{100} \equiv

( 1 ! + 2 ! + 3 ! + 4 ! + 5 ! + 6 ! + 7 ! + 8 ! + 9 ! ) ( m o d 100 ) (1! + 2! + 3! + 4! + 5! + 6! + 7! + 8! + 9!) \pmod{100} \equiv

( 1 + 2 + 6 + 24 + 20 + 20 + 40 + 20 + 80 ) ( m o d 100 ) 13 ( m o d 100 ) (1 + 2 + 6 + 24 + 20 + 20 + 40 + 20 + 80) \pmod{100} \equiv 13 \pmod{100} .

So we have reduced the problem to one of finding 1 3 33 ( m o d 100 ) 13^{33} \pmod{100} .

Now as ( 13 , 100 ) = 1 (13,100) = 1 we have by Euler's Totient Theorem that 1 3 ϕ ( 100 ) 1 ( m o d 100 ) 13^{\phi(100)} \equiv 1 \pmod{100} .

Since ϕ ( 100 ) = ϕ ( 2 2 ) × ϕ ( 5 2 ) = ( 2 2 2 1 ) ( 5 2 5 1 ) = 2 × 20 = 40 \phi(100) = \phi(2^{2}) \times \phi(5^{2}) = (2^{2} - 2^{1})(5^{2} - 5^{1}) = 2 \times 20 = 40 , we have that

1 3 40 1 ( m o d 100 ) 1 3 7 1 3 33 1 ( m o d 100 ) 13^{40} \equiv 1 \pmod{100} \Longrightarrow 13^{7}13^{33} \equiv 1 \pmod{100} ,

i.e., 1 3 33 13^{33} is the multiplicative inverse of 1 3 7 13^{7} modulo 100 100 . Next, we conveniently find that

1 3 3 ( 13 × 69 ) ( m o d 100 ) 13 ( 70 1 ) ( m o d 100 ) 13^{3} \equiv (13 \times 69) \pmod{100} \equiv 13(70 - 1) \pmod{100} \equiv

( 910 13 ) ( m o d 100 ) 3 ( m o d 100 ) (910 - 13) \pmod{100} \equiv -3 \pmod{100} , and so

1 3 7 = 1 3 3 × 1 3 3 × 13 ( 3 ) ( 3 ) ( 13 ) ( m o d 100 ) 17 ( m o d 100 ) 13^{7} = 13^{3} \times 13^{3} \times 13 \equiv (-3)(-3)(13) \pmod{100} \equiv 17 \pmod{100} .

Next, to find the multiplicative inverse of 17 17 modulo 100 100 , we use the Euclidean Algorithm:

  • 100 = 5 × 17 + 15 100 = 5 \times 17 + 15 ,

  • 17 = 1 × 15 + 2 17 = 1 \times 15 + 2 ,

  • 15 = 7 × 2 + 1 15 = 7 \times 2 + 1 .

Then

1 = 15 7 × 2 = 15 7 ( 17 15 ) = 8 × 15 7 × 17 = 1 = 15 - 7 \times 2 = 15 - 7(17 - 15) = 8 \times 15 - 7 \times 17 =

8 ( 100 5 × 17 ) 7 × 17 = 8 × 100 47 × 17 8(100 - 5 \times 17) - 7 \times 17 = 8 \times 100 - 47 \times 17 \Longrightarrow

47 × 17 = 1 8 × 100 47 × 17 1 ( m o d 100 ) 53 × 17 1 ( m o d 100 ) -47 \times 17 = 1 - 8 \times 100 \Longrightarrow -47 \times 17 \equiv 1 \pmod{100} \Longrightarrow 53 \times 17 \equiv 1 \pmod{100} .

Thus 53 53 is the multiplicative inverse of 17 17 modulo 100 100 , and so the last two digits of the given expression are

53 \Large\boxed{53} .

Alternatively, but much less fun, upon noting that 1 3 3 3 ( m o d 100 ) 13^{3} \equiv -3 \pmod{100} we have that

1 3 33 ( 3 ) 11 ( m o d 100 ) ( 3 ) ( 3 5 ) 2 ( m o d 100 ) ( 3 ) 4 3 2 ( m o d 100 ) 13^{33} \equiv (-3)^{11} \pmod{100} \equiv (-3)(3^{5})^{2} \pmod{100} \equiv (-3)43^{2} \pmod{100} \equiv

( 3 ) ( 40 + 3 ) 2 ( m o d 100 ) ( 3 ) ( 1600 + 240 + 9 ) ( m o d 100 ) ( 3 ) × 49 ( m o d 100 ) (-3)(40 + 3)^{2} \pmod{100} \equiv (-3)(1600 + 240 + 9) \pmod{100} \equiv (-3) \times 49 \pmod{100} \equiv

3 × ( 49 ) ( m o d 100 ) 3 × 51 ( m o d 100 ) 53 ( m o d 100 ) 3 \times (-49) \pmod{100} \equiv 3 \times 51 \pmod{100} \equiv \boxed{53} \pmod{100} .

Wow sir! Amazing Solution!

Md Zuhair - 4 years, 2 months ago

Log in to reply

Thanks! I had fun with this one. :)

Brian Charlesworth - 4 years, 2 months ago

What the heck

Ankush Moger - 4 years, 2 months ago
Tomás Carvalho
Apr 12, 2017

For n > 9 n > 9 , n ! n! has 2 2 and 5 5 as prime factors at least twice, so n ! 0 ( m o d 100 ) n! \equiv 0 \pmod{100} . As such

( n = 1 33 n ! ) 33 ( 1 ! + 2 ! + . . . + 9 ! ) 33 1 3 33 ( m o d 100 ) \left(\displaystyle \sum_{n=1}^{33} n!\right)^{33} \equiv (1! + 2! + ... + 9! )^{33} \equiv13 ^{33} \pmod{100} \Longrightarrow

1 3 33 = ( 10 + 3 ) 33 13^{33} = (10+3)^{33} = k = 0 33 ( 33 k ) . 1 0 33 k . 3 k \displaystyle \sum_{k=0}^{33} {33 \choose k} . 10^{33-k} . 3^{k} 0 + 0 + 0 + . . . + ( 33 32 ) . 10. 3 32 + ( 33 33 ) . 3 33 \equiv 0+0+0+ ... + {33 \choose 32} . 10 . 3^{32} + {33 \choose 33} . 3^{33} ,

because when k < 32 k < 32 the terms are multiples of 100 100 and therefore 0 ( m o d 100 ) \equiv 0 \pmod{100} . This is then equal to

33 10 3 32 + 3 33 33*10*3^{32} + 3^{33} = 3 33 ( 1 + 11 10 ) 3 33 11 3 11 3 32 33 9 16 = 3^{33}*( 1 + 11*10 ) \equiv 3^{33}*11 \equiv 3*11*3^{32} \equiv 33*9^{16} \equiv

33 ( 10 1 ) 16 33 ( ( 16 15 ) 1 0 16 15 ( 1 ) 15 + ( 16 16 ) ) 33 ( 160 + 1 ) 33*(10-1)^{16} \equiv 33*( {16 \choose 15}*10^{16-15}*(-1)^{15} + {16 \choose 16}) \equiv 33*(-160 + 1) \equiv

33 59 47 53 ( m o d 100 ) -33*59 \equiv -47 \equiv \boxed{53} \pmod{100} .

Nice solution! (+1) Much faster than my approach. Thanks for posting it. I particularly like how you went from 3 33 11 3^{33}*11 to 33 ( 10 1 ) 16 33*(10 - 1)^{16} .

P.S.. I cleaned up the LaTeX a bit. Hope it looks ok to you.

Brian Charlesworth - 4 years, 1 month ago

@Brian Charlesworth Thanks! I know simplifying /( 13^{33} ) algebraically and then applying modulo would be faster, but it wouldn't be nearly as fun, as you pointed out in the end of your solution.

Tomás Carvalho - 4 years, 1 month ago
Peter Macgregor
Feb 8, 2019

Here is a calculator free solution which uses only elementary school arithmetic.

10! and all larger factorials have two zeros as their least significant digits. (Because 2,5 and 10 all appear in the product)

So to find the last two digits of ( n = 1 33 n ! ) \displaystyle\large\left(\sum_{n=1}^{33}n!\right) we need to take only the first 9 terms. Starting from one and multiplying sequentially by 2,3,4,5,6,7,8 and 9 and retaining only the last two digits at each step it is easy to get the final two digits of the factorials as

01 02 06 24 20 20 40 20 80 01\\02\\06\\24\\20\\20\\40\\20\\80

Adding these up shows that the last two digits of the sum of factorials are 13.

To complete the problem we need to find the last two digits of ( 13 ) 33 (13)^{33} .

We can get most of the way by repeatedly squaring. Again we retain only the last two digits at each step.

1 3 2 69 1 3 4 61 1 3 8 21 1 3 16 41 1 3 32 81 13^2\rightarrow 69\\13^4 \rightarrow 61 \\ 13^8 \rightarrow 21 \\ 13^{16} \rightarrow 41 \\ 13^{32}\rightarrow 81

Then one more multiplication by 13 gives 1 3 33 53 13^{33} \rightarrow \boxed{53}

Great solution! You are missing one term in your list of factorials modulo 100. After 24, there should be two 20's in a row, one for 5 ! = 120 5! = 120 and one for 6 ! = 720 6! = 720 .

Matthew Feig - 2 years, 3 months ago

Log in to reply

oops. I've corrected the solution.

thanks Mathew

Peter Macgregor - 2 years, 3 months ago
Angelson Lascuna
Apr 12, 2017

Since any factorial from 10! onwards has at least to two trailing zeroes, we will evaluate until 9! only.

Applying modulo after evaluating and adding them up yields 13^33. 13³mod100 = 97 Tweaking a little bit, we'll tackle 97×(97²)^5 97²=9mod100 9^5=49mod100 97×49= 4753= 53mod100

Therefore, 53 is the answer.

Terry Smith
Feb 10, 2019

Then there's the Ruby code way - with Ruby's BigNum feature

'
find last 2 digits of the sum n=1 to 33 of n factorial, taken to the 33rd power
'

puts 'Go'
# --- start code here ---
sum = (F[1..33]).inject(0){|s,l|s+l}
puts sum.commify

p = 1
33.times{
    p *= sum
    puts p.commify
}
# --- end code here ---
puts 'Stop'

# sum is 8,954,945,705,218,228,090,637,347,680,100,940,313
# sum ^ 33 =     26,186,507,578,944,068,851,917,969,860,217,208,810,648,149,523,729,685,779,756,163,017,095,247,959,001,264,533,989,309,171,302,889,210,362,343,362,518,712,884,488,030,263,681,175,299,268,636,558,578,687,234,022,439,639,411,059,600,226,732,471,938,464,890,757,922,186,254,070,402,734,492,603,556,116,613,946,872,500,023,224,754,984,148,665,696,278,640,979,848,178,926,311,494,870,236,560,569,567,804,289,430,833,352,829,536,770,616,908,583,120,240,873,493,538,257,716,663,624,592,171,981,968,072,663,525,917,232,646,340,186,234,544,184,664,833,734,478,235,251,198,177,103,874,023,178,122,502,647,165,927,826,672,158,381,630,152,734,353,774,739,974,006,816,698,873,844,206,346,162,162,591,850,646,364,514,488,760,635,038,337,808,404,701,935,560,147,665,482,411,102,786,007,191,420,825,088,576,286,207,306,377,078,786,955,157,512,288,476,126,300,865,376,960,497,858,118,402,006,076,367,598,670,547,064,057,229,409,367,836,311,107,603,708,762,895,013,814,730,423,093,341,199,948,549,629,089,135,048,805,554,029,158,454,574,167,538,102,427,501,873,755,061,319,786,507,430,444,039,372,019,510,150,729,298,372,465,802,487,245,057,554,419,125,345,894,487,232,565,835,212,037,626,799,216,703,026,678,063,969,286,900,511,758,442,128,804,245,971,660,730,640,454,435,305,101,201,485,424,734,181,844,299,600,584,128,271,721,359,515,827,171,213,702,287,286,873,508,491,345,799,575,255,631,608,371,310,550,770,969,823,578,479,484,776,645,129,531,694,870,960,993,475,762,463,737,807,921,695,982,099,582,220,929,409,151,029,169,199,928,718,844,610,999,122,902,726,746,183,385,426,600,662,794,773,750,292,268,070,924,549,488,091,870,567,350,553
# last 2 are 53
# correct
Kyle T
Feb 8, 2019

https://www.wolframalpha.com/input/?i=((sum+of+n!+from+1+to+33)+%5E+33+)+mod+100

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...