login
Final digit (in decimal system) of (n^n)^n, i.e., (n^n)^n mod 10.
3

%I #30 Jan 13 2024 19:24:55

%S 1,6,3,6,5,6,7,6,9,0,1,6,3,6,5,6,7,6,9,0,1,6,3,6,5,6,7,6,9,0,1,6,3,6,

%T 5,6,7,6,9,0,1,6,3,6,5,6,7,6,9,0,1,6,3,6,5,6,7,6,9,0,1,6,3,6,5,6,7,6,

%U 9,0,1,6,3,6,5,6,7,6,9,0,1,6,3,6,5,6

%N Final digit (in decimal system) of (n^n)^n, i.e., (n^n)^n mod 10.

%C Periodic sequence with period 10.

%H <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,0,1).

%F a(n) = A120962(A002489(n)). - _Michel Marcus_, Aug 09 2023

%t Table[PowerMod[n^n, n, 10], {n, 200}]

%o (PARI) a(n)=n%=10; lift(Mod(n,10)^n^n) \\ _Charles R Greathouse IV_, Dec 27 2013

%o (Python)

%o def A229522(n): return (0, 1, 6, 3, 6, 5, 6, 7, 6, 9)[n%10] # _Chai Wah Wu_, Aug 10 2023

%Y Cf. A002489, A120962, A364789 (initial digit).

%K nonn,base,easy

%O 1,2

%A _José María Grau Ribas_, Sep 25 2013