OFFSET
1,2
COMMENTS
In A048991, n is excluded if it appears in the concatenation of all earlier terms. This sequence applies the opposite criterion and excludes n if it does NOT appear in the concatenation of all earlier terms. For example, the sequences starts with 1, 2, 3, ..., therefore 12, 23 and 123 appear in the sequence, but 10, 11 and 14 do not.
LINKS
Anthony Sand, Table of n, a(n) for n = 1..1000
FORMULA
digits(n,i=1,j) = substring(sequence,i=1,j))
EXAMPLE
The digits of 12 appear earlier in the sequence (1, 2...), therefore 12 is included.
The digits of 11 do not appear earlier in the sequence, therefore 11 is excluded.
MAPLE
M:= 4: # to get all terms with <= M digits
with(StringTools):
S:= "123456789":
nS:= length(S):
Substrings:= {seq(seq(SubString(S, a..b), b=a+1..min(9, a+M-1)), a=1..8)}:
Cands:= map(parse, Substrings):
for n from 1 to 9 do A[n]:= n od:
for n from 10 while Cands <> {} do
m:= min(Cands);
A[n]:= m;
S:= cat(S, convert(m, string));
nm:= length(m);
newSubstrings:= {seq(seq(SubString(S, a..b), b = a+nm-1..min(nS+nm, a+M-1)), a=1+nS-M .. nS)};
Cands:= select(`>`, Cands union map(parse, newSubstrings), m);
nS:= length(S);
od:
seq(A[i], i=1..n-1); # Robert Israel, Jun 22 2015
PROG
(PARI) { dmx=1000; d=vector(dmx); b=10; for(i=1, b-1, d[i]=i; print1(i, ", ")); di=b-1; n=di; while(di<dmx, n++; dig=digits(n, b); dii=1; ok=0; for(i=1, di-#dig+1, while(dii<#dig && d[i+dii-1]==dig[dii], dii++); if(dii==#dig && d[i+dii-1]==dig[dii], ok=1; i=di-#dig+1, dii=1); ); if(ok, print1(n, ", "); for(i=1, #dig, di++; if(di<=dmx, d[di]=dig[i]) ); ); ); }
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Anthony Sand, Jun 22 2015
STATUS
approved