login
a(n) = (1^1 + 2^2 . . . + n^n) mod 10.
2

%I #31 Sep 18 2024 10:34:13

%S 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,

%T 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,

%U 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

%N a(n) = (1^1 + 2^2 . . . + n^n) mod 10.

%C The last digit of 1^1 + 2^2 +...+ n^n, which has period 100.

%H G. C. Greubel, <a href="/A185353/b185353.txt">Table of n, a(n) for n = 1..1000</a>

%t Mod[Accumulate[Table[n^n, {n, 200}]], 10] (* _T. D. Noe_, Jan 27 2012 *)

%o (PARI) a(n) = sum(k=1, n, k^k) % 10; \\ _Michel Marcus_, Jun 28 2017

%o (Python)

%o from itertools import accumulate, count, islice

%o def A185353_gen(): # generator of terms

%o yield from accumulate((pow(k,k,10) for k in count(1)),func=lambda x,y:(x+y)%10)

%o A185353_list = list(islice(A185353_gen(),40)) # _Chai Wah Wu_, Jun 17 2022

%Y Cf. A000312 (n^n), A001923 (1^1 + 2^2 +...+ n^n).

%K nonn

%O 1,2

%A _Muhammed Hedayet_, Jan 26 2012

%E Extended by _T. D. Noe_, Jan 27 2012