%I #49 Jan 02 2023 12:30:50
%S 0,9,18,27,36,45,54,63,72,81,99,108,117,126,135,144,153,162,171,180,
%T 198,207,216,225,234,243,252,261,279,297,306,315,324,333,342,351,360,
%U 378,396,405,414,423,432,441,459,477,495,504,513,522,531,540,558,576,594,603,612,621,639,657,675,693,702,711,720,738,756,774,792
%N Lexicographically earliest increasing sequence such that a(n) equals the sum of digits of the terms up to and including a(n).
%C The offset could equally well be chosen to be 1, but taking it equal to zero allows us to consider {a(n); n=0,1,2...} and {a(n); n=1,2...} together, both of which satisfy the definition.
%C All terms are divisible by 9, but there is no limit on the size of the gaps. The first gap of 18 occurs after a(9)=81 followed by a(10)=99, the first gap of 27 after a(79)=972 followed by a(80)=999.
%C There seems also to be no limit on the "look-ahead" required to avoid getting stuck by a bad choice.
%H M. F. Hasler, <a href="/A248050/b248050.txt">Table of n, a(n) for n = 0..1000</a>
%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2014-October/013895.html">Cumulative sum of the digits used so far</a>, SeqFan mailing list, Oct 30 2014
%o (PARI) a(n,a=0,L=19)={local(ok(n,L)=!L||for(k=1,#Str(n),sumdigits(n+=9)/9==k&&ok(n,L-1)&&return(n))); for(i=1,n,print1(s=a",");until(s+sumdigits(a+=9)==a&&ok(a,L),));a}
%K nonn,base
%O 0,2
%A _Eric Angelini_ and _M. F. Hasler_, Oct 30 2014