OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
E. Angelini, Downgrade one of the digits of a(n-1), Nov 01 2014.
MAPLE
N:= 200: # to get the first N terms
S:= {}:
m:= 2:
a[1]:= 1:
xnext:= proc(x)
local j, Sc;
Sc:= select(`>`, S, x);
if Sc <> {} then min(Sc)
elif x < m then m
else x+1
fi
end proc:
for n from 2 to N do
adigs:= convert(convert(a[n-1], base, 10), set);
bdigs:= {$0..8} intersect map(`-`, adigs, 1);
c:= 0;
do
c:= xnext(c);
if convert(convert(c, base, 10), set) intersect bdigs <> {} then
if member(c, S) then S:= S minus {c}
else
S:= S union {$m .. c-1};
m:= c + 1;
fi;
a[n]:= c;
break
fi
od;
od:
seq(a[n], n=1..N); # Robert Israel, Nov 03 2014
PROG
(PARI) A249585(n, show=0, a=1, u=[])={for(i=2, n, show&&print1(a", "); u=setunion(u, Set(a)); D=Set(apply(d->d-1, digits(a))); while(setsearch(u, 1+m=vecmin(u)), u=setminus(u, Set(m))); for(m=m+1, 9e9, !setsearch(u, m)&&#setintersect(D, Set(digits(m))) &&(a=m)&&break)); a} /* Using a more natural and simpler until() loop is 10x slower! */
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Nov 01 2014
STATUS
approved