OFFSET
1,3
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10000 (first 2048 terms from Antti Karttunen)
FORMULA
EXAMPLE
Sierpinski number 257 --> 2+5+7 = 14 --> 1+4 = 5 thus persistence is 2.
The sixteenth Sierpinski number is 16^16 + 1 = 18446744073709551617 --> 1+8+4+4+6+7+4+4+0+7+3+7+0+9+5+5+1+6+1+7 = 89 --> 8+9 = 17 --> 1+7 = 8, thus a(16) = 3 because in three steps we obtain a number < 10. - Antti Karttunen, Dec 15 2017
MAPLE
f:= proc(n) local t, count;
t:= n^n+1;
count:= 0;
while t > 9 do
count:= count+1;
t:= convert(convert(t, base, 10), `+`);
od;
count
end proc:
map(f, [$1..100]); # Robert Israel, Dec 18 2017
MATHEMATICA
f[n_] := Length@ NestWhileList[Plus @@ IntegerDigits@# &, n^n + 1, UnsameQ@## &, All] - 2; Array[f, 105] (* Robert G. Wilson v, Dec 18 2017 *)
PROG
(PARI)
allocatemem(2^30);
A007953(n) = { my(s); while(n, s+=n%10; n\=10); s; };
A031286(n) = { my(s); while(n>9, s++; n=A007953(n)); s; }; \\ This function after Charles R Greathouse IV, Sep 13 2012
A014566(n) = (1+(n^n));
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jul 20 2007
EXTENSIONS
Erroneous terms (first at n=16) corrected by Antti Karttunen, Dec 15 2017
STATUS
approved