Find the last two digits of ⎝ ⎛ n = 1 ∑ 3 3 n ! ⎠ ⎞ 3 3 .
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.
Wow sir! Amazing Solution!
What the heck
For n > 9 , n ! has 2 and 5 as prime factors at least twice, so n ! ≡ 0 ( m o d 1 0 0 ) . As such
( n = 1 ∑ 3 3 n ! ) 3 3 ≡ ( 1 ! + 2 ! + . . . + 9 ! ) 3 3 ≡ 1 3 3 3 ( m o d 1 0 0 ) ⟹
1 3 3 3 = ( 1 0 + 3 ) 3 3 = k = 0 ∑ 3 3 ( k 3 3 ) . 1 0 3 3 − k . 3 k ≡ 0 + 0 + 0 + . . . + ( 3 2 3 3 ) . 1 0 . 3 3 2 + ( 3 3 3 3 ) . 3 3 3 ,
because when k < 3 2 the terms are multiples of 1 0 0 and therefore ≡ 0 ( m o d 1 0 0 ) . This is then equal to
3 3 ∗ 1 0 ∗ 3 3 2 + 3 3 3 = 3 3 3 ∗ ( 1 + 1 1 ∗ 1 0 ) ≡ 3 3 3 ∗ 1 1 ≡ 3 ∗ 1 1 ∗ 3 3 2 ≡ 3 3 ∗ 9 1 6 ≡
3 3 ∗ ( 1 0 − 1 ) 1 6 ≡ 3 3 ∗ ( ( 1 5 1 6 ) ∗ 1 0 1 6 − 1 5 ∗ ( − 1 ) 1 5 + ( 1 6 1 6 ) ) ≡ 3 3 ∗ ( − 1 6 0 + 1 ) ≡
− 3 3 ∗ 5 9 ≡ − 4 7 ≡ 5 3 ( m o d 1 0 0 ) .
Nice solution! (+1) Much faster than my approach. Thanks for posting it. I particularly like how you went from 3 3 3 ∗ 1 1 to 3 3 ∗ ( 1 0 − 1 ) 1 6 .
P.S.. I cleaned up the LaTeX a bit. Hope it looks ok to you.
@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.
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 ∑ 3 3 n ! ⎠ ⎞ 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
0 1 0 2 0 6 2 4 2 0 2 0 4 0 2 0 8 0
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 ( 1 3 ) 3 3 .
We can get most of the way by repeatedly squaring. Again we retain only the last two digits at each step.
1 3 2 → 6 9 1 3 4 → 6 1 1 3 8 → 2 1 1 3 1 6 → 4 1 1 3 3 2 → 8 1
Then one more multiplication by 13 gives 1 3 3 3 → 5 3
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 ! = 1 2 0 and one for 6 ! = 7 2 0 .
Log in to reply
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.
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
https://www.wolframalpha.com/input/?i=((sum+of+n!+from+1+to+33)+%5E+33+)+mod+100
Problem Loading...
Note Loading...
Set Loading...
Note first that finding the last two digits of an integer N is equivalent to finding N ( m o d 1 0 0 ) . Also,
( n = 1 ∑ 3 3 n ! ) 3 3 ( m o d 1 0 0 ) ≡ ( ( n = 1 ∑ 3 3 n ! ) ( m o d 1 0 0 ) ) 3 3 ( m o d 1 0 0 ) ≡
( n = 1 ∑ 3 3 ( n ! ( m o d 1 0 0 ) ) ) 3 3 ( m o d 1 0 0 ) .
Now for n ≥ 1 0 we have that 2 ∗ 5 ∗ 1 0 = 1 0 0 ∣ n ! , and thus n ! ( m o d 1 0 0 ) = 0 for n ≥ 1 0 . Thus
n = 1 ∑ 3 3 ( n ! ( m o d 1 0 0 ) ) ( m o d 1 0 0 ) ≡ n = 1 ∑ 9 ( n ! ( m o d 1 0 0 ) ) ( m o d 1 0 0 ) ≡
( 1 ! + 2 ! + 3 ! + 4 ! + 5 ! + 6 ! + 7 ! + 8 ! + 9 ! ) ( m o d 1 0 0 ) ≡
( 1 + 2 + 6 + 2 4 + 2 0 + 2 0 + 4 0 + 2 0 + 8 0 ) ( m o d 1 0 0 ) ≡ 1 3 ( m o d 1 0 0 ) .
So we have reduced the problem to one of finding 1 3 3 3 ( m o d 1 0 0 ) .
Now as ( 1 3 , 1 0 0 ) = 1 we have by Euler's Totient Theorem that 1 3 ϕ ( 1 0 0 ) ≡ 1 ( m o d 1 0 0 ) .
Since ϕ ( 1 0 0 ) = ϕ ( 2 2 ) × ϕ ( 5 2 ) = ( 2 2 − 2 1 ) ( 5 2 − 5 1 ) = 2 × 2 0 = 4 0 , we have that
1 3 4 0 ≡ 1 ( m o d 1 0 0 ) ⟹ 1 3 7 1 3 3 3 ≡ 1 ( m o d 1 0 0 ) ,
i.e., 1 3 3 3 is the multiplicative inverse of 1 3 7 modulo 1 0 0 . Next, we conveniently find that
1 3 3 ≡ ( 1 3 × 6 9 ) ( m o d 1 0 0 ) ≡ 1 3 ( 7 0 − 1 ) ( m o d 1 0 0 ) ≡
( 9 1 0 − 1 3 ) ( m o d 1 0 0 ) ≡ − 3 ( m o d 1 0 0 ) , and so
1 3 7 = 1 3 3 × 1 3 3 × 1 3 ≡ ( − 3 ) ( − 3 ) ( 1 3 ) ( m o d 1 0 0 ) ≡ 1 7 ( m o d 1 0 0 ) .
Next, to find the multiplicative inverse of 1 7 modulo 1 0 0 , we use the Euclidean Algorithm:
1 0 0 = 5 × 1 7 + 1 5 ,
1 7 = 1 × 1 5 + 2 ,
1 5 = 7 × 2 + 1 .
Then
1 = 1 5 − 7 × 2 = 1 5 − 7 ( 1 7 − 1 5 ) = 8 × 1 5 − 7 × 1 7 =
8 ( 1 0 0 − 5 × 1 7 ) − 7 × 1 7 = 8 × 1 0 0 − 4 7 × 1 7 ⟹
− 4 7 × 1 7 = 1 − 8 × 1 0 0 ⟹ − 4 7 × 1 7 ≡ 1 ( m o d 1 0 0 ) ⟹ 5 3 × 1 7 ≡ 1 ( m o d 1 0 0 ) .
Thus 5 3 is the multiplicative inverse of 1 7 modulo 1 0 0 , and so the last two digits of the given expression are
5 3 .
Alternatively, but much less fun, upon noting that 1 3 3 ≡ − 3 ( m o d 1 0 0 ) we have that
1 3 3 3 ≡ ( − 3 ) 1 1 ( m o d 1 0 0 ) ≡ ( − 3 ) ( 3 5 ) 2 ( m o d 1 0 0 ) ≡ ( − 3 ) 4 3 2 ( m o d 1 0 0 ) ≡
( − 3 ) ( 4 0 + 3 ) 2 ( m o d 1 0 0 ) ≡ ( − 3 ) ( 1 6 0 0 + 2 4 0 + 9 ) ( m o d 1 0 0 ) ≡ ( − 3 ) × 4 9 ( m o d 1 0 0 ) ≡
3 × ( − 4 9 ) ( m o d 1 0 0 ) ≡ 3 × 5 1 ( m o d 1 0 0 ) ≡ 5 3 ( m o d 1 0 0 ) .