login
Smallest number whose digit sum is 5^n.
1

%I #13 Jul 03 2018 02:34:06

%S 1,5,799,89999999999999,

%T 4999999999999999999999999999999999999999999999999999999999999999999999

%N Smallest number whose digit sum is 5^n.

%H Harry J. Smith, <a href="/A060713/b060713.txt">Table of n, a(n) for n = 0..5</a>

%t Do[ a = {}; While[ Apply[ Plus, a ] + 9 < 5^n, a = Append[ a, 9 ] ]; If[ Apply[ Plus, a ] != 5^n, a = Prepend[ a, 5^n - Apply[ Plus, a ] ] ]; Print[ FromDigits[ a ] ], {n, 1, 4} ]

%o (PARI) { for (n=0, 5, s=5^n; x=s\9; d=s - 9*x; write("b060713.txt", n, " ", (d+1)*10^x - 1); ) } \\ _Harry J. Smith_, Jul 10 2009

%Y Cf. A060712.

%K nonn,base

%O 0,2

%A _Robert G. Wilson v_, Apr 21 2001