cp's OEIS Frontend

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.

A031286 Additive persistence: number of summations of digits needed to obtain a single digit (the additive digital root).

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A010888 (additive digital root of n).
Cf. A031347 (multiplicative digital root of n).
Cf. A031346 (multiplicative persistence of n).
Cf. also A006050, A045646.
Cf. Numbers with additive persistence k: A304366 (k=1), A304367 (k=2), A304368 (k=3), A304373 (k=4). - Jaroslav Krizek, May 28 2018

Programs

  • Maple
    read("transforms") ;
    A031286 := proc(n)
        local a,nper;
        nper := n ;
        a := 0 ;
        while nper > 9 do
            nper := digsum(nper) ;
            a := a+1 ;
        end do:
        a ;
    end proc:
    seq(A031286(n),n=0..80) ; # R. J. Mathar, Jan 02 2018
  • Mathematica
    lst = {}; Do[s = 0; While[n > 9, s++; n = Plus @@ IntegerDigits[n]]; AppendTo[lst, s], {n, 0, 98}]; lst (* Arkadiusz Wesolowski, Oct 17 2012 *)
  • PARI
    dsum(n)=my(s);while(n,s+=n%10;n\=10);s
    a(n)=my(s);while(n>9,s++;n=dsum(n));s \\ Charles R Greathouse IV, Sep 13 2012
    
  • Python
    def A031286(n):
        ap = 0
        while n > 9:
            n = sum(int(d) for d in str(n))
            ap += 1
        return ap
    # Chai Wah Wu, Aug 23 2014

Extensions

Corrected by Reinhard Zumkeller, Feb 05 2009