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.

A061105 Smallest number whose sum of digits is n^3.

Original entry on oeis.org

0, 1, 8, 999, 19999999, 89999999999999, 999999999999999999999999, 199999999999999999999999999999999999999, 899999999999999999999999999999999999999999999999999999999
Offset: 0

Views

Author

Amarnath Murthy, Apr 20 2001

Keywords

Comments

Except for the leading digit all the other digits of a(n), n >= 1, are 9's and the leading digit is 1 or 8. (This is because the digital sum of n^3 is congruent to 0, 1, or 8 mod 9, so the best we can do is use as many 9's as possible, prefixed if necessary by 1 or 8. - N. J. A. Sloane, Jul 19 2018)

Examples

			a(4) = 19999999, 1+9+9+9+9+9+9+9 = 64 = 4^3.
		

Crossrefs

Programs

  • Mathematica
    Do[a = {}; While[Apply[Plus, a] + 9 < n^3, a = Append[a, 9]]; If[ Apply[ Plus, a] != n^3, a = Prepend[ a, n^3 - Apply[ Plus, a]] ]; Print[ FromDigits[ a]], {n, 1, 10} ]
    dsn3[n_]:=Module[{t=(n^3-{0,1,8})/9},Which[ IntegerQ[t[[1]]],FromDigits[ PadRight[ {},t[[1]],9]],IntegerQ[t[[2]]],FromDigits[ PadRight[ {1}, t[[2]]+1,9]],IntegerQ[t[[3]]],FromDigits[PadRight[{8},t[[3]]+1,9]]]]; Array[dsn3,10,0] (* Harvey P. Dale, Jul 19 2018 *)
  • PARI
    a(n) = { ((n%3)^3 + 1)*10^(n^3\9) - 1 } \\ Harry J. Smith, Jul 19 2009

Formula

a(n) = A051885(n^3).
a(n) =((n mod 3)^3+1)*10^floor[n^3/9]-1 =(A021559(n+1)+1)*10^A061263(n)-1. - Henry Bottomley, Apr 24 2001

Extensions

More terms from Robert G. Wilson v, Apr 21 2001