|
|
A071358
|
|
Least k>0 such that the last digit of (n+k)^n is the same as the last digit of n^n.
|
|
0
|
|
|
10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10, 10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10, 10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10, 10, 6, 10, 2, 10, 8, 10, 4, 10, 10, 10, 2, 10, 2, 10, 2, 10, 4, 10, 10
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|