|
|
A364578
|
|
a(n) is the smallest n-digit number whose sum of digits is n.
|
|
2
|
|
|
1, 11, 102, 1003, 10004, 100005, 1000006, 10000007, 100000008, 1000000009, 10000000019, 100000000029, 1000000000039, 10000000000049, 100000000000059, 1000000000000069, 10000000000000079, 100000000000000089, 1000000000000000099, 10000000000000000199
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
MATHEMATICA
|
Table[Module[{t=10^n}, While[Total[IntegerDigits[t]]!=n+1, t++]; t], {n, 0, 20}] (* or *) Join[{1}, 10^Range[63]+Flatten[Table[(k+1) 10^n-1, {n, 0, 6}, {k, 9}]]] (* Harvey P. Dale, Mar 31 2024 *)
|
|
PROG
|
(PARI) a(n) = my(k=10^(n-1)); while (sumdigits(k) != n, k++); k; \\ Michel Marcus, Aug 16 2023
(Python)
def a(n): m=(n-1)//9; return int("1"+"0"*(n-m-2)+str((n-1)%9)*(n>1)+"9"*m)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|