%I #17 Jul 19 2018 12:34:19
%S 0,1,8,999,19999999,89999999999999,999999999999999999999999,
%T 199999999999999999999999999999999999999,
%U 899999999999999999999999999999999999999999999999999999999
%N Smallest number whose digital sum is n^3.
%C 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)
%H Harry J. Smith, <a href="/A061105/b061105.txt">Table of n, a(n) for n=0,...,20</a>
%F 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
%e a(4) = 19999999, 1+9+9+9+9+9+9+9 = 64 = 4^3.
%t 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} ]
%t 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 *)
%o (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
%Y Cf. A061104.
%K nonn,base
%O 0,3
%A _Amarnath Murthy_, Apr 20 2001
%E More terms from _Robert G. Wilson v_, Apr 21 2001