%I #27 Mar 02 2019 02:20:56
%S 0,0,2,2,2,3,2,3,3,1,2,3,3,2,2,3,3,3,3,2,3,3,3,3,2,3,3,3,3,3,3,2,3,2,
%T 2,3,3,3,4,2,3,3,2,3,3,3,3,3,3,2,3,2,2,4,3,3,3,3,3,3,3,3,4,3,3,3,3,3,
%U 4,2,3,4,3,3,3,3,3,3,3,3,4,3,3,4,3,3,4,3,3,3,3,3,4,3,3,4,3,3,4,1,3,4,3,3,4
%N Additive persistence of Sierpinski numbers of first kind.
%H Robert G. Wilson v, <a href="/A131839/b131839.txt">Table of n, a(n) for n = 1..10000</a> (first 2048 terms from Antti Karttunen)
%F a(n) = A031286(A014566(n)). - _Antti Karttunen_, Dec 15 2017
%e Sierpinski number 257 --> 2+5+7 = 14 --> 1+4 = 5 thus persistence is 2.
%e 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
%p f:= proc(n) local t, count;
%p t:= n^n+1;
%p count:= 0;
%p while t > 9 do
%p count:= count+1;
%p t:= convert(convert(t,base,10),`+`);
%p od;
%p count
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Dec 18 2017
%t f[n_] := Length@ NestWhileList[Plus @@ IntegerDigits@# &, n^n + 1, UnsameQ@## &, All] - 2; Array[f, 105] (* _Robert G. Wilson v_, Dec 18 2017 *)
%o (PARI)
%o allocatemem(2^30);
%o A007953(n) = { my(s); while(n, s+=n%10; n\=10); s; };
%o A031286(n) = { my(s); while(n>9, s++; n=A007953(n)); s; }; \\ This function after _Charles R Greathouse IV_, Sep 13 2012
%o A014566(n) = (1+(n^n));
%o A131839(n) = A031286(A014566(n)); \\ _Antti Karttunen_, Dec 15 2017
%Y Cf. A014566, A131836.
%K easy,nonn,base
%O 1,3
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 20 2007
%E Erroneous terms (first at n=16) corrected by _Antti Karttunen_, Dec 15 2017
|