All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
2012 sum Digit (Posted on 2013-04-23) Difficulty: 3 of 5
Find the last digit of the sum
S=1^1+2^2+3^3+4^4.....+2012^2012

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution semi-analytic and fully automated solutions | Comment 2 of 4 |

The last digit of n^n repeats in a cycle of length 20. Starting with 1^1 or 21^21, etc.:

1  4  7  6  5  6  3  6  9  0  1  6  3  6  5  6  7  4  9  0

discovered from:

 10   for I0=0 to 800 step 20
 20     for I=I0+1 to I0+20
 30        print modpow(I,I,10);
 40     next
 50     print
 60   next

which produces 40 recurrences of the cycle.

These add to 94, whose last digit is 4.

2000 of these cycles clearly end in zero, without doing any arithmetic.

So we just need the sum of the first 12 of these:

1  4  7  6  5  6  3  6  9  0  1  6

they add to 54, so the last digit is 4, which is the answer.


Method 2:

10   for N=1 to 2012
20      P=modpow(N,N,10^1000)
30      Sum=(Sum+P)@10^1000
40   next
50   print Sum

finds the last thousand digits are:

 3263618477870928817492859605414875314411924369456849999525776039685010768307707
03124116912001760045463460305741043902798425092530357768340098382857800204359174
43671327956385730116004874146694352448832561335985341701747064336983902542659850
20123741853225057513867902040834339114921816736974023727473486598985269960921090
06324527994569262599452805284354899807237844944558686825794550399478721475496811
90991991373325241206791275082924230171960974150318590885112305748187559234918187
40561958641536435944236494163693366900563563864084884977496593125880401136438751
31770830706311942291991490870650413201669003243355242547509784041762416675528412
23744723064886074897763455970190947726848922385265251061771036830800324782030903
43996653348561694987543662325266977368126608932066698107918574539081216946519955
11323040344139113723508598654809080656227073852095055201935670917124721819573928
27608416546748344616222788835593382294944981160816088590021307337447532473156337
37427017179617895037355219990116787366584

which includes the last digit 4.


  Posted by Charlie on 2013-04-23 12:25:49
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information