OFFSET
1,1
COMMENTS
The values of n^n (A000312) end in every digit except for 2 and 8. The sequence of final digits of n^n (A056849) is periodic with period 20; for n=1,2,... the last digits are [1, 4, 7, 6, 5, 6, 3, 6, 9, 0, 1, 6, 3, 6, 5, 6, 7, 4, 9, 0]. Thus, 6 is the most common final digit of n^n. Since 6 does not occur at any odd index in the list above, all terms of a(n) are even. Also, from the distribution of 6's in the list, we can see that the difference between any two consecutive values of a(n) will be 2, 4 or 8.
LINKS
Felix Fröhlich, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,1,-1).
FORMULA
a(n) = a(n-1) + a(n-6) - a(n-7) for n > 7. - Wesley Ivan Hurt, Oct 08 2017
G.f.: 2*x*(1 + x^2)*(2 + x - x^2 + x^3 + 2*x^4) / ((1 - x)^2*(1 + x)*(1 - x + x^2)*(1 + x + x^2)). - Colin Barker, Dec 13 2018
MATHEMATICA
LinearRecurrence[{1, 0, 0, 0, 0, 1, -1}, {4, 6, 8, 12, 14, 16, 24}, 59] (* Ray Chandler, Mar 08 2017 *)
PROG
(PARI) is(n) = Mod(n, 10)^n==6 \\ Felix Fröhlich, Apr 07 2016
(Magma) I:=[4, 6, 8, 12, 14, 16, 24]; [n le 7 select I[n] else Self(n-1)+Self(n-6)-Self(n-7): n in [1..60]]; // Vincenzo Librandi, Oct 09 2017
(PARI) Vec(2*x*(1 + x^2)*(2 + x - x^2 + x^3 + 2*x^4) / ((1 - x)^2*(1 + x)*(1 - x + x^2)*(1 + x + x^2)) + O(x^59)) \\ Colin Barker, Dec 13 2018
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Wesley Ivan Hurt, Apr 04 2016
STATUS
approved