This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A031286 #53 Feb 16 2025 08:32:36 %S A031286 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,2,1,1,1,1, %T A031286 1,1,1,2,2,2,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,2,2,2,2, %U A031286 2,2,1,1,1,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2 %N A031286 Additive persistence: number of summations of digits needed to obtain a single digit (the additive digital root). %H A031286 Chai Wah Wu, <a href="/A031286/b031286.txt">Table of n, a(n) for n = 0..10000</a> %H A031286 Antonios Meimaris, <a href="http://www.academia.edu/11654065/On_the_additive_persistence_of_a_number_in_base_p">On the additive persistence of a number in base p</a>, Preprint, 2015. %H A031286 N. J. A. Sloane, <a href="http://neilsloane.com/doc/persistence.html">The persistence of a number</a>, J. Recreational Math., 6 (1973), 97-98. %H A031286 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/AdditivePersistence.html">Additive Persistence</a> %p A031286 read("transforms") ; %p A031286 A031286 := proc(n) %p A031286 local a,nper; %p A031286 nper := n ; %p A031286 a := 0 ; %p A031286 while nper > 9 do %p A031286 nper := digsum(nper) ; %p A031286 a := a+1 ; %p A031286 end do: %p A031286 a ; %p A031286 end proc: %p A031286 seq(A031286(n),n=0..80) ; # _R. J. Mathar_, Jan 02 2018 %t A031286 lst = {}; Do[s = 0; While[n > 9, s++; n = Plus @@ IntegerDigits[n]]; AppendTo[lst, s], {n, 0, 98}]; lst (* _Arkadiusz Wesolowski_, Oct 17 2012 *) %o A031286 (PARI) dsum(n)=my(s);while(n,s+=n%10;n\=10);s %o A031286 a(n)=my(s);while(n>9,s++;n=dsum(n));s \\ _Charles R Greathouse IV_, Sep 13 2012 %o A031286 (Python) %o A031286 def A031286(n): %o A031286 ap = 0 %o A031286 while n > 9: %o A031286 n = sum(int(d) for d in str(n)) %o A031286 ap += 1 %o A031286 return ap %o A031286 # _Chai Wah Wu_, Aug 23 2014 %Y A031286 Cf. A010888 (additive digital root of n). %Y A031286 Cf. A031347 (multiplicative digital root of n). %Y A031286 Cf. A031346 (multiplicative persistence of n). %Y A031286 Cf. also A006050, A045646. %Y A031286 Cf. Numbers with additive persistence k: A304366 (k=1), A304367 (k=2), A304368 (k=3), A304373 (k=4). - _Jaroslav Krizek_, May 28 2018 %K A031286 nonn,base %O A031286 0,20 %A A031286 _Eric W. Weisstein_ %E A031286 Corrected by _Reinhard Zumkeller_, Feb 05 2009