OFFSET
1,3
COMMENTS
EXAMPLE
a(8) = 1999 and 1 + 9 + 9 + 9 = 28; so a(9) = 9999 because 9 + 9 + 9 + 9 = 36 and 36 - 28 = 8.
PROG
(Python)
s = 0
for i in range(1, 100):
..alfa = ""
..k = i + s
..s = k
..while k > 9:
....alfa = alfa + "9"
....k = k - 9
..alfa = str(k)+alfa
..print alfa
(PARI) findnext(x, k) = {sx = sumdigits(x); y = 1; while (sumdigits(y) - sx != k, y++); y; }
lista(nn) = {print1(x = 0, ", "); for (k=1, nn, y = findnext(x, k); print1(y, ", "); x = y; ); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Francesco Di Matteo, Feb 23 2016
STATUS
approved