OFFSET
1,2
COMMENTS
a(n+1) - a(n) is a power of 10 or 2 if a(n) is of the form 10^m - 1. - David A. Corneth, Nov 26 2018
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
FORMULA
a((9*m^2 + 7*m + 2) / 2) = 10^m - 1, m > 0. - David A. Corneth, Nov 25 2018
EXAMPLE
The beginning list is 1,2,3,4,5,6,7,8,9,1,11; but 1 < 9 so omit it.
MAPLE
d := N->`if`(N=0, [0], ListTools[Reverse](convert(N, base, 10))); a := N->sum(d(N)[n]*10^(n-1), n=1..nops(d(N))); dropsort := proc(S)::list; description "Forms a strictly increasing list by dropping terms."; local T, V; T := k->max(seq(S[j], j=1..k)); V := ListTools[MakeUnique]([seq(T(j), j=1..nops(S))]); return(V); end proc; dropsort([seq(a(n), n=1..2000)]);
MATHEMATICA
Union@ FoldList[Max, IntegerReverse@ Range@ 1007] (* Michael De Vlieger, Nov 25 2018 *)
PROG
(PARI) nxt(n) = {my(d = digits(n), i = 1); while(i <= #d && d[i] == 9, i++); if(i <= #d, n+10^(#d-i), n+2)}
first(n) = my(res = vector(n)); res[1] = 1; for(i = 2, n, res[i] = nxt(res[i-1])); res \\ David A. Corneth, Nov 25 2018
CROSSREFS
KEYWORD
AUTHOR
Francois Jooste (phukraut(AT)hotmail.com), Oct 23 2002
STATUS
approved