login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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

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

Cf. A249591, A067581.

Sequence in context: A172503 A107859 A294069 * A067524 A069555 A069035

Adjacent sequences:  A249582 A249583 A249584 * A249586 A249587 A249588

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 2 12:26 EST 2021. Contains 341750 sequences. (Running on oeis4.)