|
|
A061105
|
|
Smallest number whose digital sum is n^3.
|
|
6
|
|
|
|
OFFSET
|
0,3
|
|
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)
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(4) = 19999999, 1+9+9+9+9+9+9+9 = 64 = 4^3.
|
|
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 *)
|
|
PROG
|
(PARI) { for (n=0, 20, a=((n%3)^3 + 1)*10^(n^3\9) - 1; write("b061105.txt", n, " ", a) ) } \\ Harry J. Smith, Jul 19 2009
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|