OFFSET
1,1
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1).
FORMULA
a(n) is periodic with period (10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10) of length 20
MATHEMATICA
LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, {10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10}, 80] (* Ray Chandler, Aug 26 2015 *)
PROG
(PARI) a(n)=if(n<0, 0, s=1; while(abs((n+s)^n%10-n^n%10)>0, s++); s)
(Python)
def a(n):
k, target = 2, pow(n, n, 10)
while pow(n+k, n, 10) != target: k += 2
return k
print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Oct 06 2021
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Benoit Cloitre, Aug 13 2002
STATUS
approved