(In reply to
solution by SilverKnight)
Wow SK, I had gone through all of the below before reading your solution and realizing that the number that I would be multiplying that final 8 by was 10:
A number ending in a digit 0 will have powers that all end in 0.
A number ending in 1 will have powers all ending in 1.
A number ending in 2 will have powers with ending digits that cycle 2, 4, 8, 6 in a cycle of 4. As 99 is congruent to 3 mod 4, 2^99 ends in 8, the third in the cycle.
A number ending in 4 will have powers with ending digits that cycle 4, 6 in a cycle of 2. As 99 is congruent to 1 mod 2, 4^99 ends in 4, the first in the cycle.
A number ending in 5 will have powers all ending in 5.
A number ending in 6 will have powers all ending in 6.
A number ending in 7 will have powers with ending digits that cycle 7, 9, 3, 1 in a cycle of 4. As 99 is congruent to 3 mod 4, 7^99 ends in 3, the third in the cycle.
A number ending in 8 will have powers with ending digits that cycle 8, 4, 2, 6 in a cycle of 4. As 99 is congruent to 3 mod 4, 8^99 ends in 2, the third in the cycle.
A number ending in 9 will have powers with ending digits that cycle 9, 1 in a cycle of 2. As 99 is congruent to 1 mod 2, 9^99 ends in 9, the first in the cycle.
Adding these up mod 10, a complete decade sums to 8.
Multiply that by 10, and the last digit is of course zero as SK has said.
At least my method would work even if it had started at say 11^99.
Simpler still is the straightforward way of using the extended precision capability of UBASIC:
10 for i=1 to 99
20 t=t+i^99
30 next
40 print t
run
5812206997600753463391342462747345840904209101124814483884686650470731323698643
56708140949517237598499723088539628510405242259308985010276468113327453424717072
493455029858959571265494893360597217500
OK

where the last of the 198 digits is indeed zero.

Posted by Charlie
on 20040123 10:07:55 