login
A185353
a(n) = (1^1 + 2^2 . . . + n^n) mod 10.
2
1, 5, 2, 8, 3, 9, 2, 8, 7, 7, 8, 4, 7, 3, 8, 4, 1, 5, 4, 4, 5, 9, 6, 2, 7, 3, 6, 2, 1, 1, 2, 8, 1, 7, 2, 8, 5, 9, 8, 8, 9, 3, 0, 6, 1, 7, 0, 6, 5, 5, 6, 2, 5, 1, 6, 2, 9, 3, 2, 2, 3, 7, 4, 0, 5, 1, 4, 0, 9, 9, 0, 6, 9, 5, 0, 6, 3, 7, 6, 6, 7, 1, 8, 4, 9, 5, 8, 4, 3, 3, 4, 0, 3, 9, 4, 0, 7, 1, 0, 0
OFFSET
1,2
COMMENTS
The last digit of 1^1 + 2^2 +...+ n^n, which has period 100.
LINKS
MATHEMATICA
Mod[Accumulate[Table[n^n, {n, 200}]], 10] (* T. D. Noe, Jan 27 2012 *)
PROG
(PARI) a(n) = sum(k=1, n, k^k) % 10; \\ Michel Marcus, Jun 28 2017
(Python)
from itertools import accumulate, count, islice
def A185353_gen(): # generator of terms
yield from accumulate((pow(k, k, 10) for k in count(1)), func=lambda x, y:(x+y)%10)
A185353_list = list(islice(A185353_gen(), 40)) # Chai Wah Wu, Jun 17 2022
CROSSREFS
Cf. A000312 (n^n), A001923 (1^1 + 2^2 +...+ n^n).
Sequence in context: A155975 A152956 A099873 * A345712 A355972 A168202
KEYWORD
nonn
AUTHOR
Muhammed Hedayet, Jan 26 2012
EXTENSIONS
Extended by T. D. Noe, Jan 27 2012
STATUS
approved