login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249585 Lexicographically earliest permutation of the positive integers such that a(n+1) has at least one digit which increased by 1 is a digit of a(n). 3
1, 10, 20, 11, 30, 2, 12, 13, 21, 14, 3, 22, 15, 4, 23, 16, 5, 24, 17, 6, 25, 18, 7, 26, 19, 8, 27, 31, 28, 37, 29, 38, 32, 41, 33, 42, 34, 35, 40, 36, 45, 39, 48, 43, 52, 44, 53, 46, 50, 47, 56, 49, 58, 54, 63, 51, 60, 55, 64, 57, 61, 59, 68, 65, 74, 62, 71, 66, 75, 67, 69, 78, 70, 76, 85, 72, 81, 73, 82, 77, 86, 79, 80, 87, 96, 83, 92, 84, 93, 88 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
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
Sequence in context: A172503 A107859 A294069 * A067524 A069555 A069035
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Nov 01 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 04:12 EDT 2024. Contains 371782 sequences. (Running on oeis4.)