OFFSET
1,3
COMMENTS
EXAMPLE
a(1) = 1 so a(2) also = 1 since there is only one term up to and including a(1) = 1 which has digit sum >= 1. Then a(3) = 2 because now there are two terms having digit sum >= 1. a(11) = 10 so a(12) = 11 since all terms up to and including a(11) have digit sum >= 1. a(19) = 9, whose digit sum (9) sets a record, thus a(20) = 1, which means a(21) = 20.
PROG
(PARI) first(n) = {
my(res = vector(n), digs = vector(n));
res[1] = 1; digs[1] = 1;
for(i = 2, n,
s = 1 + sum(j = 1, i-2, digs[j] >= digs[i-1]);
res[i] = s;
digs[i] = sumdigits(s)
);
res
} \\ David A. Corneth, Dec 24 2024
CROSSREFS
KEYWORD
nonn,base,new
AUTHOR
David James Sycamore, Dec 09 2024
EXTENSIONS
More terms from David A. Corneth, Dec 24 2024
STATUS
approved