%I #23 Jun 05 2016 02:02:27
%S 1,1,4,0,4,2,0,7,1,0,1,5,0,4,7,0,7,8,0,1,4,0,4,2,0,7,1,0,1,5,0,4,7,0,
%T 7,8,0,1,4,0,4,2,0,7,1,0,1,5,0,4,7,0,7,8,0,1,4,0,4,2,0,7,1,0,1,5,0,4,
%U 7,0,7,8,0,1,4,0,4,2,0,7,1,0,1,5,0,4,7
%N a(n) = n^n (mod 9).
%C For n>0, periodic with period 18 = A174824(9): repeat [1, 4, 0, 4, 2, 0, 7, 1, 0, 1, 5, 0, 4, 7, 0, 7, 8, 0].
%H <a href="/index/Rec#order_18">Index entries for linear recurrences with constant coefficients</a>, signature (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1).
%F G.f.: (x^18 - 8*x^17 - 7*x^16 - 7*x^14 - 4*x^13 - 5*x^11 - x^10 - x^8 - 7*x^7 - 2*x^5 - 4*x^4 - 4*x^2 - x - 1)/(x^18 - 1). - _Chai Wah Wu_, Jun 04 2016
%F a(n) = A000312(n) mod 9. - _Michel Marcus_, Jun 04 2016
%t Table[PowerMod[n,n,9], {n,0,100}]
%t Join[{1},LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},{1, 4, 0, 4, 2, 0, 7, 1, 0, 1, 5, 0, 4, 7, 0, 7, 8, 0},86]] (* _Ray Chandler_, Aug 27 2015 *)
%o (PARI) a(n)=lift(Mod(n,9)^n) \\ _Charles R Greathouse IV_, Jan 23 2012
%Y Cf. A000312, A174824.
%K nonn,easy
%O 0,3
%A _José María Grau Ribas_, Jan 18 2012