%I #52 Mar 31 2020 04:44:44
%S 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 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 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 Additive persistence: number of summations of digits needed to obtain a single digit (the additive digital root).
%H Chai Wah Wu, <a href="/A031286/b031286.txt">Table of n, a(n) for n = 0..10000</a>
%H 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 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 Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/AdditivePersistence.html">Additive Persistence</a>
%p read("transforms") ;
%p A031286 := proc(n)
%p local a,nper;
%p nper := n ;
%p a := 0 ;
%p while nper > 9 do
%p nper := digsum(nper) ;
%p a := a+1 ;
%p end do:
%p a ;
%p end proc:
%p seq(A031286(n),n=0..80) ; # _R. J. Mathar_, Jan 02 2018
%t 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 (PARI) dsum(n)=my(s);while(n,s+=n%10;n\=10);s
%o a(n)=my(s);while(n>9,s++;n=dsum(n));s \\ _Charles R Greathouse IV_, Sep 13 2012
%o (Python)
%o def A031286(n):
%o ap = 0
%o while n > 9:
%o n = sum(int(d) for d in str(n))
%o ap += 1
%o return ap
%o # _Chai Wah Wu_, Aug 23 2014
%Y Cf. A010888 (additive digital root of n).
%Y Cf. A031347 (multiplicative digital root of n).
%Y Cf. A031346 (multiplicative persistence of n).
%Y Cf. also A006050, A045646.
%Y Cf. Numbers with additive persistence k: A304366 (k=1), A304367 (k=2), A304368 (k=3), A304373 (k=4). - _Jaroslav Krizek_, May 28 2018
%K nonn,base
%O 0,20
%A _Eric W. Weisstein_
%E Corrected by _Reinhard Zumkeller_, Feb 05 2009