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-10 of 66 results. Next

A230107 Define a sequence by b(1)=n, b(k+1)=b(k)+(sum of digits of b(k)); a(n) is the number of steps needed to reach a term in A004207, or a(n) = -1 if the sequence never joins A004207.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane and Reinhard Zumkeller, Oct 15 2013; corrected Oct 20 2013

Keywords

Comments

Looking at b(k) mod 9 shows that a(n) = -1 whenever n is a multiple of 3 (since then the b sequence is disjoint from A004207).
Conjecture: the b sequence, for any starting value n, will eventually merge with one of A000004 (the zero sequence), A004207, A016052 or A016096.

Examples

			For n=3, A016052 never meets A004207, so a(3) = -1.
For n=5, A007618 meets A004207 at the 53rd term, 620, so a(5) = 53.
		

Crossrefs

Programs

  • Haskell
    import Data.Maybe (fromMaybe)
    a230107 = fromMaybe (-1) . f (10^5) 1 1 1 where
       f k i u j v | k <= 0    = Nothing
                   | u < v     = f (k - 1) (i + 1) (a062028 u) j v
                   | u > v     = f (k - 1) i u (j + 1) (a062028 v)
                   | otherwise = Just j
  • 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(1) and f(s), and p is the position where it occurred.
    # If f(1), f(s) are disjoint for M terms, returns (-1,-1)
    S1:=convert(f(1),set):
    g:=proc(s) global f,S1; local t1,p,S2,S3;
    S2:=convert(f(s),set);
    S3:= S1 intersect S2;
    t1:=min(S3);
    if (t1 = infinity) then RETURN(-1,-1); else
      member(t1,f(s),'p'); RETURN(t1,p-1); fi;
    end;
    [seq(g(n)[2],n=1..20)];

A176718 Partial sums of A004207.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 55, 83, 121, 170, 232, 302, 379, 470, 571, 674, 781, 896, 1018, 1145, 1282, 1430, 1591, 1760, 1945, 2144, 2362, 2591, 2833, 3083, 3340, 3611, 3892, 4184, 4489, 4802, 5122, 5447, 5782, 6128, 6487, 6863, 7255, 7661, 8077, 8504, 8944, 9392
Offset: 0

Views

Author

Jonathan Vos Post, Apr 25 2010

Keywords

Comments

Partial sums of a(1) = 1, a(n) = sum of digits of all previous terms. The subsequence of primes in this sequence begins: 2, 83, 379, 571, 2591, 2833, 3083, 6863, 10831. The subsequence of squares in this sequence begins: 1, 4, 16, 121, 4489.

Examples

			a(7) = 1 + 1 + 2 + 4 + 8 + 16 + 23 + 28 = 83 is prime.
		

Crossrefs

Programs

Formula

a(n) = SUM[i=0..n] A004207(i) = SUM[i=0..n] {b(1) = 1, b(j) = sum of digits of b(j) for j = 0..i} = SUM[i=0..n] {b(1) = 1, b(k) = A007953(b(k)) for k = 0..i}.

A062028 a(n) = n + sum of the digits of n.

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 77
Offset: 0

Views

Author

Amarnath Murthy, Jun 02 2001

Keywords

Comments

a(n) = A248110(n,A007953(n)). - Reinhard Zumkeller, Oct 01 2014

Examples

			a(34) = 34 + 3 + 4 = 41, a(40) = 40 + 4 = 44.
		

Crossrefs

Indices of: A047791 (primes), A107743 (composites), A066564 (squares), A084661 (cubes).
Iterations: A004207 (start=1), A016052 (start=3), A007618 (start=5), A006507 (start=7), A016096 (start=9).

Programs

  • Haskell
    a062028 n = a007953 n + n  -- Reinhard Zumkeller, Oct 11 2013
    
  • Maple
    with(numtheory): for n from 1 to 100 do a := convert(n,base,10):
    c := add(a[i],i=1..nops(a)): printf(`%d,`,n+c); od:
    A062028 := n -> n+add(i,i=convert(n,base,10)) # M. F. Hasler, Nov 08 2018
  • Mathematica
    Table[n + Total[IntegerDigits[n]], {n, 0, 100}]
  • PARI
    A062028(n)=n+sumdigits(n) \\ M. F. Hasler, Jul 19 2015
    
  • Python
    def a(n): return n + sum(map(int, str(n)))
    print([a(n) for n in range(71)]) # Michael S. Branicky, Jan 09 2023

Formula

a(n) = n + A007953(n).
a(n) = A160939(n+1) - 1. - Filip Zaludek, Oct 26 2016

Extensions

More terms from Vladeta Jovovic, Jun 05 2001

A001370 Sum of digits of 2^n.

Original entry on oeis.org

1, 2, 4, 8, 7, 5, 10, 11, 13, 8, 7, 14, 19, 20, 22, 26, 25, 14, 19, 29, 31, 26, 25, 41, 37, 29, 40, 35, 43, 41, 37, 47, 58, 62, 61, 59, 64, 56, 67, 71, 61, 50, 46, 56, 58, 62, 70, 68, 73, 65, 76, 80, 79, 77, 82, 92, 85, 80, 70, 77
Offset: 0

Views

Author

Keywords

Comments

Same digital roots as A065075 (sum of digits of the sum of the preceding numbers) and A004207 (sum of digits of all previous terms); they enter into the cycle {1 2 4 8 7 5}. - Alexandre Wajnberg, Dec 11 2005
It is believed that a(n) ~ n*9*log_10(2)/2, but this is an open problem. - N. J. A. Sloane, Apr 21 2013
The Radcliffe preprint shows that a(n) > log_4(n). - M. F. Hasler, May 18 2017
Sierpiński shows that if n >= A137284(k-1) then a(n) >= k (Problem 209). - David Radcliffe, Dec 26 2022

References

  • Archimedeans Problems Drive, Eureka, 26 (1963), 12.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. sum of digits of k^n: A004166 (k=3), A065713 (k=4), A066001(k=5), A066002 (k=6), A066003(k=7), A066004 (k=8), A065999 (k=9), A066005 (k=11), A066006 (k=12).

Programs

  • Haskell
    a001370 = a007953 . a000079  -- Reinhard Zumkeller, Aug 14 2015
  • Maple
    seq(convert(convert(2^n,base,10),`+`),n=0..1000); # Robert Israel, Mar 29 2015
  • Mathematica
    Table[Total[IntegerDigits[2^n]], {n, 0, 55}] (* Vincenzo Librandi, Oct 08 2013 *)
  • PARI
    a(n)=sumdigits(2^n); \\ Michel Marcus, Nov 01 2013
    
  • Python
    [sum(map(int, str(2**n))) for n in range(56)] # David Radcliffe, Mar 29 2015
    

Formula

a(n) = A007953(A000079(n)). - Michel Marcus, Nov 01 2013

A010062 a(0)=1; thereafter a(n+1) = a(n) + number of 1's in binary representation of a(n).

Original entry on oeis.org

1, 2, 3, 5, 7, 10, 12, 14, 17, 19, 22, 25, 28, 31, 36, 38, 41, 44, 47, 52, 55, 60, 64, 65, 67, 70, 73, 76, 79, 84, 87, 92, 96, 98, 101, 105, 109, 114, 118, 123, 129, 131, 134, 137, 140, 143, 148, 151, 156, 160, 162, 165, 169, 173, 178, 182, 187, 193, 196, 199, 204
Offset: 0

Views

Author

Leonid Broukhis, Mar 15 1996

Keywords

Comments

Sequence A230297 (and A157845 without initial term) converted from binary to decimal, cf. formula. - M. F. Hasler, Nov 18 2019

Examples

			a(7) = 14 because a(6) = 12, which is 1100 in binary (having 2 on bits), and 12 + 2 = 14.
a(8) = 17 because a(7) = 14, which is 1110 in binary (having 3 on bits), and 14 + 3 = 17.
		

Crossrefs

First row of A228083.
For the base-10 analog see A004207.
Cf. A000120, A010061, A092391, A229167, A096303, A229743, A229744, A230297 (this sequence written in binary), A230298 (read mod 2).
See A230088 for partial sums.
Equals A028897 o A230297 = A028897 o A157845 (up to offset); see also A007088.

Programs

Formula

a(n) = (n/2)*log n + O(n*sqrt(log n * loglog n)), where log means log_2. In particular, a(n) ~ (n/2)*log n. [Stolarsky]
a(n + 1) = A092391(a(n)) = a(n) + A000120(a(n)). - Reinhard Zumkeller, May 27 2012, May 08 2004; corrected thanks to a notice by Lambert Herrgesell
a(n) = A028897(A230297(n)) = A028897(A157845(n+1)). - M. F. Hasler, Nov 18 2019

Extensions

More terms from Benoit Cloitre, Jun 02 2002
Stolarsky reference from Matthew C. Russell, Oct 08 2013

A037123 a(n) = a(n-1) + sum of digits of n.

Original entry on oeis.org

0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 46, 48, 51, 55, 60, 66, 73, 81, 90, 100, 102, 105, 109, 114, 120, 127, 135, 144, 154, 165, 168, 172, 177, 183, 190, 198, 207, 217, 228, 240, 244, 249, 255, 262, 270, 279, 289, 300, 312, 325, 330, 336, 343, 351, 360, 370, 381
Offset: 0

Views

Author

Vasiliy Danilov (danilovv(AT)usa.net), Jun 15 1998

Keywords

Comments

Sum of digits of A007908(n). - Franz Vrabec, Oct 22 2007
Also digital sum of A138793(n) for n > 0. - Bruno Berselli, May 27 2011
Sum of the digital sum of i for i from 0 to n. - N. J. A. Sloane, Nov 13 2013

References

  • N. Agronomof, Sobre una función numérica, Revista Mat. Hispano-Americana 1 (1926), 267-269.
  • Maurice d'Ocagne, Sur certaines sommations arithmétiques, J. Sciencias Mathematicas e Astronomicas 7 (1886), 117-128.

Crossrefs

Cf. also A074784, A231688, A231689.
Partial sums of A007953.

Programs

  • Magma
    [ n eq 0 select 0 else &+[&+Intseq(k): k in [0..n]]: n in [0..56] ];  // Bruno Berselli, May 27 2011
  • Maple
    # From N. J. A. Sloane, Nov 13 2013:
    digsum:=proc(n,B) local a; a := convert(n, base, B):
    add(a[i], i=1..nops(a)): end;
    f:=proc(n,k,B) global digsum; local i;
    add( digsum(i,B)^k,i=0..n); end;
    lprint([seq(digsum(n,10),n=0..100)]); # A007953
    lprint([seq(f(n,1,10),n=0..100)]); #A037123
    lprint([seq(f(n,2,10),n=0..100)]); #A074784
    lprint([seq(f(n,3,10),n=0..100)]); #A231688
    lprint([seq(f(n,4,10),n=0..100)]); #A231689
  • Mathematica
    Table[Plus@@Flatten[IntegerDigits[Range[n]]], {n, 0, 200}] (* Enrique Pérez Herrero, Oct 12 2015 *)
    a[0] = 0; a[n_] := a[n - 1] + Plus @@ IntegerDigits@ n; Array[a, 70, 0] (* Robert G. Wilson v, Jul 06 2018 *)
  • PARI
    a(n)=n*(n+1)/2-9*sum(k=1,n,sum(i=1,ceil(log(k)/log(10)),floor(k/10^i)))
    
  • PARI
    a(n)={n++;my(t,i,s);c=n;while(c!=0,i++;c\=10);for(j=1,i,d=(n\10^(i-j))%10;t+=(10^(i-j)*(s*d+binomial(d,2)+d*9*(i-j)/2));s+=d);t} \\ David A. Corneth, Aug 16 2013
    
  • Perl
    for $i (0..100){ @j = split "", $i; for (@j){ $sum += $; } print "$sum,"; } __END_ # gamo(AT)telecable.es
    

Formula

a(n) = Sum_{k=0..n} s(k) = Sum_{k=0..n} A007953(k), where s(k) denote the sum of the digits of k in decimal representation. Asymptotic expression: a(n-1) = Sum_{k=0..n-1} s(k) = 4.5*n*log_10(n) + O(n). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002
a(n) = n*(n+1)/2 - 9*Sum_{k=1..n} Sum_{i=1..ceiling(log_10(k))} floor(k/10^i). - Benoit Cloitre, Aug 28 2003
From Hieronymus Fischer, Jul 11 2007: (Start)
G.f.: Sum_{k>=1} ((x^k - x^(k+10^k) - 9x^(10^k))/(1-x^(10^k)))/(1-x)^2.
a(n) = (1/2)*((n+1)*(n - 18*Sum_{k>=1} floor(n/10^k)) + 9*Sum_{k>=1} (1 + floor(n/10^k))*floor(n/10^k)*10^k).
a(n) = (1/2)*((n+1)*(2*A007953(n)-n) + 9*Sum_{k>=1} (1+floor(n/10^k))*floor(n/10^k)*10^k). (End)
a(n) = A007953(A053064(n)). - Reinhard Zumkeller, Oct 10 2008
From Wojciech Raszka, Jun 14 2019: (Start)
a(10^k - 1) = 10*a(10^(k - 1) - 1) + 45*10^(k - 1) for k > 0.
a(n) = a(n mod m) + MSD*a(m - 1) + (MSD*(MSD - 1)/2)*m + MSD*((n mod m) + 1), where m = 10^(A055642(n) - 1), MSD = A000030(n). (End)

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002

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

A230093 Number of values of k such that k + (sum of digits of k) is n.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1
Offset: 0

Views

Author

N. J. A. Sloane, Oct 10 2013

Keywords

Comments

a(n) is the number of times n occurs in A062028.
For n>=1, a(10^n) = a(9*n-1). - Max Alekseyev, Feb 23 2021

Crossrefs

Cf. A006064, A007953 (sum of digits), A062028 (n + sum of its digits), A004207, A228085, A003052, A176995, A225793, A230094, A055642.
Cf. A107740 (this applied to primes).

Programs

  • Haskell
    a230093 n = length $ filter ((== n) . a062028) [n - 9 * a055642 n .. n]  -- Reinhard Zumkeller, Oct 11 2013
    
  • Maple
    # Maple code for A062028, A230093, A003052, A225793, A230094.
    with(LinearAlgebra):
    read transforms; # to get digsum
    M := 1000; A062028 := Array(0..M); A230093 := Array(0..M);
    for n from 0 to M do
       m := n+digsum(n);
       A062028[n] := m;
       if m <= M then A230093[m] := A230093[m]+1; fi;
    od:
    t1:=[seq(A062028[i],i=0..M)]; # A062028 as list (but incorrect offset 1)
    t2:=[seq(A230093[i],i=0..M)]; # A230093 as list, but then a(0) has index 1
    # A003052 := COMPl(t1); # COMPl has issues, may be incorrect for M <> 1000
    ctmax:=4;
    for h from 0 to ctmax do ct[h] := []; od:
    for i from 1 to M do
       h := lis2[i];
       if h <= ctmax then ct[h] := [op(ct[h]),i]; fi;
    od:
    A225793 := ct[1]; A230094 := ct[2]; # A003052 := ct[0]; # see there for better code
  • Mathematica
    Module[{nn=110,a,b,c,d},a=Tally[Table[x+Total[IntegerDigits[x]],{x,0,nn}]];b=a[[All,1]];c={#,0}&/@Complement[Range[nn],b];d=Sort[Join[a,c]];d[[All, 2]]] (* Harvey P. Dale, Jun 12 2019 *)
  • PARI
    apply( A230093(n)=sum(i=n>0,min(9*logint(n+!n,10)+8,n\2),sumdigits(n-i)==i), [1..150]) \\ M. F. Hasler, Nov 08 2018

Extensions

Edited by M. F. Hasler, Nov 08 2018

A007618 a(n) = a(n-1) + sum of digits of a(n-1), a(1) = 5.

Original entry on oeis.org

5, 10, 11, 13, 17, 25, 32, 37, 47, 58, 71, 79, 95, 109, 119, 130, 134, 142, 149, 163, 173, 184, 197, 214, 221, 226, 236, 247, 260, 268, 284, 298, 317, 328, 341, 349, 365, 379, 398, 418, 431, 439, 455, 469, 488, 508, 521, 529, 545, 559, 578, 598, 620, 628, 644
Offset: 1

Views

Author

Keywords

Comments

a(n) = A004207(n+5) for n > 52. - Reinhard Zumkeller, Oct 14 2013
a(2) = 10 and a(590) = 10000 are the first two powers of 10 in this sequence; there are no others below a(19017393928) = 1000000000093. Conjecture: the sequence contains infinitely many powers of 10. - Charles R Greathouse IV, Mar 29 2022

References

  • N. Agronomof, Problem 4421, L'Intermédiaire des mathématiciens, v. 21 (1914), p. 147. (Mentions sequence starting at 11.) - N. J. A. Sloane, Nov 22 2013.
  • 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).

Crossrefs

Programs

  • Haskell
    a007618 n = a007618_list !! (n-1)
    a007618_list = iterate a062028 5  -- Reinhard Zumkeller, Oct 14 2013
    
  • Python
    from itertools import accumulate
    def f(an, _): return an + sum(int(d) for d in str(an))
    print(list(accumulate([5]*55, f))) # Michael S. Branicky, May 10 2021

Formula

a(n) = A062028(a(n-1)) for n > 1. - Reinhard Zumkeller, Oct 14 2013

A017245 a(n) = 9*n + 7.

Original entry on oeis.org

7, 16, 25, 34, 43, 52, 61, 70, 79, 88, 97, 106, 115, 124, 133, 142, 151, 160, 169, 178, 187, 196, 205, 214, 223, 232, 241, 250, 259, 268, 277, 286, 295, 304, 313, 322, 331, 340, 349, 358, 367, 376, 385, 394, 403, 412, 421, 430, 439, 448, 457, 466, 475, 484
Offset: 0

Views

Author

Keywords

Comments

Numbers whose digital root is 7. - Halfdan Skjerning, Mar 15 2018

Crossrefs

Programs

Formula

a(n)^2 = A156676(n+1) + A017137(n). - Reinhard Zumkeller, Jul 13 2010
From Vincenzo Librandi, Apr 30 2015: (Start)
G.f.: (7+2*x)/(1-x)^2.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n>2. (End)
E.g.f.: exp(x)*(7 + 9*x). - Stefano Spezia, Dec 08 2024
Showing 1-10 of 66 results. Next