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!)
A067581 a(n) = smallest integer not yet in the sequence with no digits in common with a(n-1), a(0)=0. 23
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 22, 11, 20, 13, 24, 15, 23, 14, 25, 16, 27, 18, 26, 17, 28, 19, 30, 12, 33, 21, 34, 29, 31, 40, 32, 41, 35, 42, 36, 44, 37, 45, 38, 46, 39, 47, 50, 43, 51, 48, 52, 49, 53, 60, 54, 61, 55, 62, 57, 63, 58, 64, 59, 66, 70, 56, 71, 65, 72, 68, 73, 69 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

David W. Wilson has shown that the sequence contains every positive integer except those containing all the digits 1 through 9 (which obviously have no possible predecessor). Jun 04 2002

a(A137857(n)) = A137857(n). - Reinhard Zumkeller, Feb 15 2008

LINKS

Reinhard Zumkeller and Zak Seidov, Table of n, a(n) for n = 0..10000

EXAMPLE

a(14) = 13, since a(13) = 20 and all integers smaller than 13 have a digit in common with 20 or have already appeared in the sequence.

MATHEMATICA

f[s_List] := Block[{k = 1, id = IntegerDigits@ s[[ -1]]}, While[ MemberQ[s, k] || Intersection[id, IntegerDigits@k] != {}, k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* Robert G. Wilson v, Apr 03 2009 *)

PROG

(Haskell)

import Data.List (delete, intersect); import Data.Function (on)

a067581 n = a067581_list !! (n-1)

a067581_list = 1 : f 1 [2..] where

   f u vs = v : f v (delete v vs)

     where v : _ = filter (null . (intersect `on` show) u) vs

-- Reinhard Zumkeller, Jul 01 2013

(PARI)  {u=0; a=0; for(n=0, 99, print1(a", "); u+=1<<a; D=Set(if(a, digits(a))); for(k=0, 9e9, bittest(u, k)&&next; #setintersect(D, Set(digits(k)))&&next; a=k; break))} \\ M. F. Hasler, Nov 01 2014

(Python)

from itertools import count, islice, product as P

def only(s, D=1): # numbers with >= D digits only from s

    yield from (int("".join(p)) for d in count(D) for p in P(s, repeat=d))

def agen(): # generator of terms

    aset, an, minan = {0}, 0, 1

    while True:

        yield an

        an, s = minan, set(str(an))

        use = "".join(c for c in "0123456789" if c not in s)

        for an in only(use, D=len(str(minan))):

            if an not in aset: break

        aset.add(an)

        while minan in aset: minan += 1

print(list(islice(agen(), 73))) # Michael S. Branicky, Jun 30 2022

CROSSREFS

Cf. A136332, A184992, A239664, A249585, A249591.

See also A276512, A276633, A276766.

Sequence in context: A085890 A274842 A134817 * A099469 A039112 A160015

Adjacent sequences:  A067578 A067579 A067580 * A067582 A067583 A067584

KEYWORD

easy,nonn,base,nice,look

AUTHOR

Ulrich Schimke (ulrschimke(AT)aol.com)

EXTENSIONS

Extended to a(0)=0 by M. F. Hasler, Nov 02 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 September 26 02:05 EDT 2022. Contains 356986 sequences. (Running on oeis4.)