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.

Showing 1-3 of 3 results.

A004207 a(0) = 1, a(n) = sum of digits of all previous terms.

Original entry on oeis.org

1, 1, 2, 4, 8, 16, 23, 28, 38, 49, 62, 70, 77, 91, 101, 103, 107, 115, 122, 127, 137, 148, 161, 169, 185, 199, 218, 229, 242, 250, 257, 271, 281, 292, 305, 313, 320, 325, 335, 346, 359, 376, 392, 406, 416, 427, 440, 448, 464, 478, 497, 517, 530, 538
Offset: 0

Views

Author

Keywords

Comments

If the leading 1 is omitted, this is the important sequence b(1)=1, for n >= 2, b(n) = b(n-1) + sum of digits of b(n-1). Cf. A016052, A016096, etc. - N. J. A. Sloane, Dec 01 2013
Same digital roots as A065075 (Sum of digits of the sum of the preceding numbers) and A001370 (Sum of digits of 2^n); they end in the cycle {1 2 4 8 7 5}. - Alexandre Wajnberg, Dec 11 2005
More precisely, mod 9 this sequence is 1 (1 2 4 8 7 5)*, the parenthesized part being repeated indefinitely. This shows that this sequence is disjoint from A016052. - N. J. A. Sloane, Oct 15 2013
There are infinitely many even terms (Belov 2003).
a(n) = A007618(n-5) for n > 57; a(n) = A006507(n-4) for n > 15. - Reinhard Zumkeller, Oct 14 2013

References

  • N. Agronomof, Problem 4421, L'Intermédiaire des mathématiciens, v. 21 (1914), p. 147.
  • D. R. Kaprekar, Puzzles of the Self-Numbers. 311 Devlali Camp, Devlali, India, 1959.
  • D. R. Kaprekar, The Mathematics of the New Self Numbers, Privately printed, 311 Devlali Camp, Devlali, India, 1963.
  • J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 65.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • G. E. Stevens and L. G. Hunsberger, A Result and a Conjecture on Digit Sum Sequences, J. Recreational Math. 27, no. 4 (1995), pp. 285-288.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 37.

Crossrefs

For the base-2 analog see A010062.
A065075 gives sum of digits of a(n).
See A219675 for an essentially identical sequence.

Programs

  • Haskell
    a004207 n = a004207_list !! n
    a004207_list = 1 : iterate a062028 1
    -- Reinhard Zumkeller, Oct 14 2013, Sep 12 2011
    
  • Maple
    read("transforms") :
    A004207 := proc(n)
        option remember;
        if n = 0 then
            1;
        else
            add( digsum(procname(i)),i=0..n-1) ;
        end if;
    end proc: # R. J. Mathar, Apr 02 2014
    # second Maple program:
    a:= proc(n) option remember; `if`(n<2, 1, (t->
         t+add(i, i=convert(t, base, 10)))(a(n-1)))
        end:
    seq(a(n), n=0..60);  # Alois P. Heinz, Jul 31 2022
  • Mathematica
    f[s_] := Append[s, Plus @@ Flatten[IntegerDigits /@ s]]; Nest[f, {1}, 55] (* Robert G. Wilson v, May 26 2006 *)
    f[n_] := n + Plus @@ IntegerDigits@n; Join[{1}, NestList[f, 1, 80]] (* Alonso del Arte, May 27 2006 *)
  • PARI
    a(n) = { my(f(d, i) = d+vecsum(digits(d)), S=vector(n)); S[1]=1; for(k=1, n-1, S[k+1] = fold(f, S[1..k])); S } \\ Satish Bysany, Mar 03 2017
    
  • PARI
    a = 1; print1(a, ", "); for(i = 1, 50, print1(a, ", "); a = a + sumdigits(a)); \\ Nile Nepenthe Wynar, Feb 10 2018
    
  • Python
    from itertools import islice
    def agen():
        yield 1; an = 1
        while True: yield an; an += sum(map(int, str(an)))
    print(list(islice(agen(), 54))) # Michael S. Branicky, Jul 31 2022

Formula

For n>1, a(n) = a(n-1) + sum of digits of a(n-1).
For n > 1: a(n) = A062028(a(n-1)). - Reinhard Zumkeller, Oct 14 2013

Extensions

Errors from 25th term on corrected by Leonid Broukhis, Mar 15 1996
Typo in definition fixed by Reinhard Zumkeller, Sep 14 2011

A016052 a(1) = 3; for n >= 1, a(n+1) = a(n) + sum of its digits.

Original entry on oeis.org

3, 6, 12, 15, 21, 24, 30, 33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, 147, 159, 174, 186, 201, 204, 210, 213, 219, 231, 237, 249, 264, 276, 291, 303, 309, 321, 327, 339, 354, 366, 381, 393, 408, 420, 426, 438, 453, 465, 480, 492
Offset: 1

Views

Author

Keywords

Comments

Mod 9 this sequence is 3, 6, 3, 6, 3, 6, ... This shows that this sequence is disjoint from A004207. - N. J. A. Sloane, Oct 15 2013

References

  • D. R. Kaprekar, Puzzles of the Self-Numbers. 311 Devlali Camp, Devlali, India, 1959.
  • D. R. Kaprekar, The Mathematics of the New Self Numbers, Privately printed, 311 Devlali Camp, Devlali, India, 1963.
  • G. E. Stevens and L. G. Hunsberger, A Result and a Conjecture on Digit Sum Sequences, J. Recreational Math. 27, no. 4 (1995), pp. 285-288.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 34-35.

Crossrefs

Programs

  • Haskell
    a016052 n = a016052_list !! (n-1)
    a016052_list = iterate a062028 3  -- Reinhard Zumkeller, Oct 14 2013
    
  • Mathematica
    NestList[# + Total[IntegerDigits[#]] &, 3, 51] (* Jayanta Basu, Aug 11 2013 *)
    a[1] = 3; a[n_] := a[n] = a[n - 1] + Total@ IntegerDigits@ a[n - 1]; Array[a, 80] (* Robert G. Wilson v, Jun 27 2014 *)
  • PARI
    a_list(nn) = { my(f(n, i) = n + vecsum(digits(n)), S=vector(nn+1)); S[1]=3; for(k=2, #S, S[k] = fold(f, S[1..k-1])); S[2..#S] } \\ Satish Bysany, Mar 04 2017
    
  • Python
    from itertools import islice
    def A016052_gen(): # generator of terms
        yield (a:=3)
        while True: yield (a:=a+sum(map(int,str(a))))
    A016052_list = list(islice(A016052_gen(),20)) # Chai Wah Wu, Jun 16 2024

Formula

a(n) = A062028(a(n-1)) for n > 1. - Reinhard Zumkeller, Oct 14 2013
a(n) - a(n-1) = A084228(n+1). - Robert G. Wilson v, Jun 27 2014

A230299 Define a sequence b_s by b_s(1)=s, b_s(k+1)=b_s(k)+(sum of digits of b_s(k)); a(n) is the number of steps needed for b_n to reach a term in one of b_0, b_1, b_3 or b_9, or a(n) = -1 if b_n never joins one of these four sequences.

Original entry on oeis.org

0, 0, 0, 0, 0, 52, 0, 11, 0, 0, 51, 50, 0, 49, 10, 0, 0, 48, 0, 9, 50, 0, 49, 0, 0, 47, 48, 0, 0, 8, 0, 49, 46, 0, 47, 48, 0, 45, 0, 0, 7, 46, 7, 47, 6, 0, 45, 44, 6, 0, 46, 0, 5, 5, 0, 45, 44, 0, 43, 4, 5, 4, 0, 0, 4, 44, 4, 43, 3, 0, 0, 42, 0, 3, 3, 4, 43, 0
Offset: 0

Views

Author

Keywords

Comments

We conjecture that a(n) is never -1.

Crossrefs

Programs

  • Maple
    read transforms; # to get digsum
    M:=2000;
    # f(s) returns the sequence k->k+digsum(k) starting at s
    f:=proc(s) global M; option remember; local n,k,s1;
    s1:=[s]; k:=s;
    for n from 1 to M do  k:=k+digsum(k);
    s1:=[op(s1),k]; od: end;
    # g(s) returns (x,p), where x = first number in common between
    # f(s) and one of f(1), f(3), f(9) and p is the position where it occurred.
    # If f(s) and all of f(1), f(3), f(9) are disjoint for M terms, returns (-1,-1)
    S1:=convert(f(1),set):
    S3:=convert(f(3),set):
    S9:=convert(f(9),set):
    g:=proc(s) global f,S1,S3,S9; local t1,p,T0,T1,T2;
    T0:=f(s):
    T1:=convert(T0,set);
    if ((s mod 9) = 3) or ((s mod 9) = 6) then   T2:= T1 intersect S3;   t1:=min(T2);   if (t1 = infinity) then RETURN(-1,-1); else     member(t1,T0,'p'); RETURN(t1,p-1); fi;
    elif ((s mod 9) = 0) then   T2:= T1 intersect S9;   t1:=min(T2);   if (t1 = infinity) then RETURN(-1,-1); else     member(t1,T0,'p'); RETURN(t1,p-1); fi;
    else   T2:= T1 intersect S1;   t1:=min(T2);   if (t1 = infinity) then RETURN(-1,-1); else     member(t1,T0,'p'); RETURN(t1,p-1); fi;
    fi;
    end;
    [seq(g(n)[2],n=1..45)];

Extensions

Terms a(46) and beyond from Lars Blomberg, Jan 10 2018
Showing 1-3 of 3 results.