Source: Original. Based upon a puzzle from reader Jimmy Chng Gim Hong.
Claudio wrote a nice HTML-based script to calculate the results for different bases.
I was most intrigued by the uniformity in the periods regardless of the base. And how the first power of a period was always less than or equal to the number of digits.
First power that repeats Length of repeating cycle number of last digits number of last digits base 1 2 3 4 5 1 2 3 4 5 2 5 22 103 504 2505 4 20 100 500 2500 3 5 21 101 501 5001 4 20 100 500 5000 4 3 11 52 252 1253 2 10 50 250 1250 5 2 3 5 8 13 1 1 2 4 8 6 2 7 28 129 630 1 5 25 125 625 7 5 5 21 101 501 4 4 20 100 500 8 5 21 101 502 2502 4 20 100 500 2500 9 3 11 51 251 2501 2 10 50 250 2500 10 3 3 4 5 6 1 1 1 1 1 11 3 11 51 501 5001 1 10 50 500 5000 12 6 21 102 502 2503 4 20 100 500 2500 13 6 21 101 501 5001 4 20 100 500 5000 14 4 12 53 254 1255 2 10 50 250 1250 15 3 4 5 6 7 1 2 2 2 2 16 3 6 26 126 627 1 5 25 125 625 17 6 21 101 501 2501 4 20 100 500 2500 18 6 6 23 104 505 4 4 20 100 500 19 4 11 51 501 5001 2 10 50 500 5000 20 3 3 4 5 6 1 1 1 1 1[To obtain the first power of each cycle, subtract the "length of cycle" from the "first to repeat". In each case, the first power is always less than or equal to N. I found this surprisingly regular. And there exists a cycle length for which ALL bases cycle since any smaller cycle-lengths are factors of the larger ones. (i.e. for N=5, all bases cycle with a length of 5000.) - KD]
The puzzle is equivalent to evaluating the powers k^i (mod 10^N). There is a result of Euler that if g(m) is the number of numbers less than m which are relatively prime to m then x^g(m) =1 (mod m) provided that x is relatively prime to m. Also if x^h = 1 (mod m) then h divides g(m). Now g(100) = 40, g(1000) = 400, and g(10000) = 4000 and for values of k not divisible by 2 or 5 the cycle lengths shown in the table do indeed divide the corresponding value of g(10^N). It appears that the cycle lengths for other values of k have the same property. Not every value of k belongs to a cycle.
To illustrate, consider the case N = 2. the values of k: 2, 5, 6, 10, 14, 15, and 18, within the listed values, do not belong to a cycle. For example the cycle with k = 2 begins (and ends) at 4 and does not include 2, and the cycle with k = 15 consists of the 2 numbers 25 and 75. The cycles for k = 2 and k = 12 consist of identical sets of numbers but in a different order, and there are other overlapping cycles. The cases N = 3 and N = 4 have similar properties.