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-8 of 8 results.

A003132 Sum of squares of digits of n.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 2, 5, 10, 17, 26, 37, 50, 65, 82, 4, 5, 8, 13, 20, 29, 40, 53, 68, 85, 9, 10, 13, 18, 25, 34, 45, 58, 73, 90, 16, 17, 20, 25, 32, 41, 52, 65, 80, 97, 25, 26, 29, 34, 41, 50, 61, 74, 89, 106, 36, 37, 40, 45, 52, 61, 72, 85, 100, 117, 49
Offset: 0

Views

Author

Keywords

Comments

It is easy to show that a(n) < 81*(log_10(n)+1). - Stefan Steinerberger, Mar 25 2006
It is known that a(0)=0 and a(1)=1 are the only fixed points of this map. For more information about iterations of this map, see A007770, A099645 and A000216 ff. - M. F. Hasler, May 24 2009
Also known as the "Happy number map", since happy numbers A007770 are those whose trajectory under iterations of this map ends at 1. - M. F. Hasler, Jun 03 2025

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Hugo Steinhaus, One Hundred Problems in Elementary Mathematics, Dover New York, 1979, republication of English translation of Sto Zadań, Basic Books, New York, 1964. Chapter I.2, An interesting property of numbers, pp. 11-12 (available on Google Books).

Crossrefs

Concerning iterations of this map, see A003621, A039943, A099645, A031176, A007770, A000216 (starting with 2), A000218 (starting with 3), A080709 (starting with 4, this is the only nontrivial limit cycle), A000221 (starting with 5), A008460 (starting with 6), A008462 (starting with 8), A008463 (starting with 9), A139566 (starting with 15), A122065 (starting with 74169). - M. F. Hasler, May 24 2009
Cf. A080151, A051885 (record values and where they occur).

Programs

  • Haskell
    a003132 0 = 0
    a003132 x = d ^ 2 + a003132 x' where (x', d) = divMod x 10
    -- Reinhard Zumkeller, May 10 2015, Aug 07 2012, Jul 10 2011
    
  • Magma
    [0] cat [&+[d^2: d in Intseq(n)]: n in [1..80]]; // Bruno Berselli, Feb 01 2013
    
  • Maple
    A003132 := proc(n) local d; add(d^2,d=convert(n,base,10)) ; end proc: # R. J. Mathar, Oct 16 2010
  • Mathematica
    Table[Sum[DigitCount[n][[i]]*i^2, {i, 1, 9}], {n, 0, 40}] (* Stefan Steinerberger, Mar 25 2006 *)
    Total/@(IntegerDigits[Range[0,80]]^2) (* Harvey P. Dale, Jun 20 2011 *)
  • PARI
    A003132(n)=norml2(digits(n)) \\ M. F. Hasler, May 24 2009, updated Apr 12 2015
    
  • Python
    def A003132(n): return sum(int(d)**2 for d in str(n)) # Chai Wah Wu, Apr 02 2021

Formula

a(n) = n^2 - 20*n*floor(n/10) + 81*(Sum_{k>0} floor(n/10^k)^2) + 20*Sum_{k>0} floor(n/10^k)*(floor(n/10^k) - floor(n/10^(k+1))). - Hieronymus Fischer, Jun 17 2007
a(10n+k) = a(n)+k^2, 0 <= k < 10. - Hieronymus Fischer, Jun 17 2007
a(n) = A007953(A048377(n)) - A007953(n). - Reinhard Zumkeller, Jul 10 2011

Extensions

More terms from Stefan Steinerberger, Mar 25 2006
Terms checked using the given PARI code, M. F. Hasler, May 24 2009
Replaced the Maple program with a version which works also for arguments with >2 digits, R. J. Mathar, Oct 16 2010
Added ref to Porges. Steinhaus also treated iterations of this function in his Polish book Sto zadań, but I don't have access to it. - Don Knuth, Sep 07 2015

A051885 Smallest number whose sum of digits is n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 199, 299, 399, 499, 599, 699, 799, 899, 999, 1999, 2999, 3999, 4999, 5999, 6999, 7999, 8999, 9999, 19999, 29999, 39999, 49999, 59999, 69999, 79999, 89999, 99999, 199999, 299999, 399999, 499999
Offset: 0

Views

Author

Felice Russo, Dec 15 1999

Keywords

Comments

This is also the list of lunar triangular numbers: A087052 with duplicates removed. - N. J. A. Sloane, Jan 25 2011
Numbers n such that A061486(n) = n. - Amarnath Murthy, May 06 2001
The product of digits incremented by 1 is the same as the number incremented by 1. If a(n) = abcd...(a,b,c,d, etc. are digits of a(n)) {a(n) + 1} = (a+1)*(b+1)(c+1)*(d+1)*..., e.g., 299 + 1 = (2+1)*(9+1)*(9+1) = 300. - Amarnath Murthy, Jul 29 2003
A138471(a(n)) = 0. - Reinhard Zumkeller, Mar 19 2008
a(n+1) = A108971(A179988(n)). - Reinhard Zumkeller, Aug 09 2010, Jul 10 2011
Positions of records in A003132: A080151(n) = A003132(a(n)). - Reinhard Zumkeller, Jul 10 2011
a(n) = A242614(n,1). - Reinhard Zumkeller, Jul 16 2014
A254524(a(n)) = 1. - Reinhard Zumkeller, Oct 09 2015
The slowest strictly increasing sequence of nonnegative integers such that, for any two terms, calculating the difference of their decimal representations requires no borrowing. - Rick L. Shepherd, Aug 11 2017

Crossrefs

Numbers of form i*b^j-1 (i=1..b-1, j >= 0) for bases b = 2 through 9: A000225, A062318, A180516, A181287, A181288, A181303, A165804, A140576. - N. J. A. Sloane, Jan 25 2011
Cf. A002283.
Cf. A254524.

Programs

  • Haskell
    a051885 n = (m + 1) * 10^n' - 1 where (n',m) = divMod n 9
    -- Reinhard Zumkeller, Jul 10 2011
    
  • Magma
    [i*10^j-1: i in [1..9], j in [0..5]];
    
  • Maple
    b:=10; t1:=[]; for j from 0 to 15 do for i from 1 to b-1 do t1:=[op(t1), i*b^j-1]; od: od: t1; # N. J. A. Sloane, Jan 25 2011
  • Mathematica
    a[n_] := (Mod[n, 9] + 1)*10^Floor[n/9] - 1; Table[a[n], {n, 0, 49}](* Jean-François Alcover, Dec 01 2011, after Henry Bottomley *)
  • PARI
    A051885(n) = (n%9+1)*10^(n\9)-1  \\ M. F. Hasler, Jun 17 2012
    
  • PARI
    first(n) = Vec(x*(x^2 + x + 1)*(x^6 + x^3 + 1)/((x - 1)*(10*x^9 - 1)) + O(x^n), -n) \\ Iain Fox, Dec 30 2017
    
  • Python
    def A051885(n): return ((n % 9)+1)*10**(n//9)-1 # Chai Wah Wu, Apr 04 2021

Formula

These are the numbers i*10^j-1 (i=1..9, j >= 0). - N. J. A. Sloane, Jan 25 2011
a(n) = ((n mod 9) + 1)*10^floor(n/9) - 1 = a(n-1) + 10^floor((n-1)/9). - Henry Bottomley, Apr 24 2001
a(n) = A037124(n+1) - 1. - Reinhard Zumkeller, Jan 03 2008, Jul 10 2011
G.f.: x*(x^2+x+1)*(x^6+x^3+1) / ((x-1)*(10*x^9-1)). - Colin Barker, Feb 01 2013

Extensions

More terms from James Sellers, Dec 16 1999
Offset fixed by Reinhard Zumkeller, Jul 10 2011

A002477 Wonderful Demlo numbers: a(n) = ((10^n - 1)/9)^2.

Original entry on oeis.org

1, 121, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 12345678987654321, 1234567900987654321, 123456790120987654321, 12345679012320987654321, 1234567901234320987654321
Offset: 1

Views

Author

Keywords

Comments

Only the first nine terms of this sequence are palindromes. - Bui Quang Tuan, Mar 30 2015
Not all of the terms are Demlo numbers as defined by Kaprekar, i.e., concat(L,M,R) with M and L+R repdigits using the same digit. For example, a(10), a(19), a(28) are not, but a(k) for k = 11, 12, ..., 18 are. - M. F. Hasler, Nov 18 2017

Examples

			From _José de Jesús Camacho Medina_, Apr 01 2016: (Start)
n=1: ....................... 1 = 9 / 9;
n=2: ..................... 121 = 1089 / 9;
n=3: ................... 12321 = 110889 / 9;
n=4: ................. 1234321 = 11108889 / 9;
n=5: ............... 123454321 = 1111088889 / 9;
n=6: ............. 12345654321 = 111110888889 / 9;
n=7: ........... 1234567654321 = 11111108888889 / 9;
n=8: ......... 123456787654321 = 1111111088888889 / 9;
n=9: ....... 12345678987654321 = 111111110888888889 / 9.        (End)
a(11) = concat(L = 1234567901, R = 20987654321), with L + R = 22222222222 = 2*(10^11-1)/9, of same length as R. - _M. F. Hasler_, Nov 23 2017
		

References

  • D. R. Kaprekar, On Wonderful Demlo numbers, Math. Stud., 6 (1938), 68.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 29.
  • 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

Programs

Formula

G.f.: x*(1+10*x) / ((1-x)*(1-10*x)*(1-100*x)). - Simon Plouffe in his 1992 dissertation
a(n+1) = 100*a(n) + 20*A000042(n) + 1; a(1) = 1. - Reinhard Zumkeller, May 31 2010
a(n) = A000042(n)^2.
a(n) = A075412(n)/9 = A178630(n)/18 = A178631(n)/27 = A075415(n)/36 = A178632(n)/45 = A178633(n)/54 = A178634(n)/63 = A178635(n)/72 = A059988(n)/81. - Reinhard Zumkeller, May 31 2010
a(n+2) = -1000*a(n)+110*a(n+1)+11. - Alexander R. Povolotsky, Jun 06 2014
E.g.f.: exp(x)*(1 - 2*exp(9*x) + exp(99*x))/81. - Stefano Spezia, May 23 2025

Extensions

Minor edits from N. J. A. Sloane, Aug 18 2009
Further edits from Reinhard Zumkeller, May 12 2010

A080160 Squares that are digit sums of Wonderful Demlo numbers A002477.

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 49, 64, 81, 324, 441, 576, 729, 900, 1089, 1296, 2025, 2304, 2601, 2916, 3249, 3600, 3969, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 9801, 10404, 11025, 11664
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2005

Keywords

Comments

These are the squares in A080151.
x^2 is a term iff x mod 81 is in {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 21, 24, 27, 30, 33, 36, 45, 48, 51, 54, 57, 60, 63, 72, 73, 74, 75, 76, 77, 78, 79, 80}. - Robert Israel, Jul 30 2025

Crossrefs

Programs

  • Maple
    b:=n->sum(convert(((10^(n+1)-1)/9)^2,base,10)[j],j=1..2*n+1): a:=proc(n) if type(sqrt(b(n)),integer)=true then b(n) else fi end: seq(a(n),n=0..2000); # Emeric Deutsch, Jun 19 2005
  • Mathematica
    A080151[n_] := (9^2)*(n/9 - FractionalPart[n/9] + FractionalPart[n/9]^2)
    A080151[Select[Range[10000], IntegerQ[Sqrt[A080151[#]]] &]]
    (* Enrique Pérez Herrero, Nov 05 2022 *)

Extensions

More terms from Emeric Deutsch, Jun 19 2005

A080161 Indices of Wonderful Demlo numbers A002477 whose digit sums are squares.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 36, 51, 66, 81, 102, 123, 144, 225, 258, 291, 324, 363, 402, 441, 576, 593, 610, 627, 644, 661, 678, 695, 712, 729, 748, 767, 786, 805, 824, 843, 862, 881, 900, 1089, 1158, 1227, 1296, 1371, 1446, 1521, 1764, 1851, 1938, 2025
Offset: 1

Views

Author

Eric W. Weisstein, Jan 31 2003

Keywords

Comments

The numbers 9*n^2 (A016766), with n > 0, are in this sequence. - Enrique Pérez Herrero, Sep 26 2020

Crossrefs

Programs

  • Mathematica
    A080151[n_] := (9^2)*(n/9 - FractionalPart[n/9] + FractionalPart[n/9]^2)
    Select[Range[10000], IntegerQ[Sqrt[A080151[#]]] &]
    (* Enrique Pérez Herrero, Sep 26 2020 *)
  • PARI
    for(k=1,10^5,issquare((k\9)*81+(k%9)^2)&&print1(k,", ")) \\ Jeppe Stig Nielsen, May 27 2023

A080162 Wonderful Demlo numbers A002477 whose digit sums are squares.

Original entry on oeis.org

1, 121, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 12345678987654321, 12345679012345679012345679012345678987654320987654320987654320987654321
Offset: 1

Views

Author

Eric W. Weisstein, Jan 31 2003

Keywords

Comments

The next term (a(11)) has 101 digits. - Harvey P. Dale, Jun 16 2025

Crossrefs

Programs

  • Mathematica
    Select[LinearRecurrence[{111,-1110,1000},{1,121,12321},40],IntegerQ[Sqrt[Total[IntegerDigits[#]]]]&] (* Harvey P. Dale, Jun 16 2025 *)
  • PARI
    for(k=1,100,my(d=((10^k-1)/9)^2); issquare(sumdigits(d)) && print1(d,", ")) \\ Jeppe Stig Nielsen, May 27 2023

A081648 Integers congruent to 0, 1, 4, 9, 16, 25, 36, 49 or 64 (mod 81) which are not squares.

Original entry on oeis.org

82, 85, 90, 97, 106, 117, 130, 145, 162, 163, 166, 171, 178, 187, 198, 211, 226, 243, 244, 247, 252, 259, 268, 279, 292, 307, 325, 328, 333, 340, 349, 360, 373, 388, 405, 406, 409, 414, 421, 430, 454, 469, 486, 487, 490, 495, 502, 511, 522, 535, 550, 567
Offset: 1

Views

Author

Robert G. Wilson v, Mar 26 2003

Keywords

References

  • Mark A. Herkommer, Number Theory, A Programmer's Guide, McGraw-Hill, New York, 1999, page 315.

Crossrefs

Programs

  • Mathematica
    Select[ Range[567], (Mod[ #, 81] == 0 || Mod[ #, 81] == 1 || Mod[ #, 81] == 4 || Mod[ #, 81] == 9 || Mod[ #, 81] == 16 || Mod[ #, 81] == 25 || Mod[ #, 81] == 36 || Mod[ #, 81] == 49 || Mod[ #, 81] == 64) && !IntegerQ[ Sqrt[ # ]] & ]
    Select[Range[600],IntegerQ[Sqrt[Mod[#,81]]]&&!IntegerQ[Sqrt[#]]&] (* Harvey P. Dale, May 13 2018 *)

A080150 Let m = Wonderful Demlo number A002477(n); a(n) = square of the sum of digits of m.

Original entry on oeis.org

1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 6724, 7225, 8100, 9409, 11236, 13689, 16900, 21025, 26244, 26569, 27556, 29241, 31684, 34969, 39204, 44521, 51076, 59049, 59536, 61009, 63504, 67081, 71824, 77841, 85264, 94249, 104976, 105625
Offset: 1

Views

Author

Eric W. Weisstein, Jan 31 2003

Keywords

Comments

These numbers are themselves squares, their square roots being in A080151.

Crossrefs

Formula

a(n) = (A080151(n))^2.

Extensions

Name corrected by Robert Israel, Aug 06 2019
Showing 1-8 of 8 results.