cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A067581 a(n) = smallest integer not yet in the sequence with no digits in common with a(n-1), a(0)=0.

Original entry on oeis.org

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
Offset: 0

Views

Author

Ulrich Schimke (ulrschimke(AT)aol.com)

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • 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
    
  • 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 *)
  • PARI
    {u=0; a=0; for(n=0, 99, print1(a", "); u+=1<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

Extensions

Extended to a(0)=0 by M. F. Hasler, Nov 02 2014

A276512 a(n) = smallest integer not yet in the sequence with no digits in common with a(n-2); a(0)=0, a(1)=1.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22, 20, 13, 14, 24, 23, 15, 16, 26, 25, 17, 18, 28, 27, 19, 30, 32, 12, 40, 33, 21, 29, 34, 31, 50, 42, 36, 35, 41, 44, 37, 38, 45, 46, 39, 51, 47, 43, 52, 55, 48, 49, 53, 56, 60, 70, 54, 58, 61, 62, 57, 59, 63, 64, 71, 72, 65, 66, 73, 74, 68, 69, 75
Offset: 0

Views

Author

Zak Seidov and Eric Angelini, Sep 06 2016

Keywords

Comments

This is not a permutation of the nonnegative integers. E.g. 123456789 and 1023456789 (the smallest pandigital number) are not members.
a(n) = n for n = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 34, 84, 104, 105, 1449, 2889, 3183, ...

Crossrefs

Programs

  • Mathematica
    s={0,1};Do[a=s[[-2]];n=2; While[MemberQ[s,n]||Intersection [IntegerDigits[a],IntegerDigits[n]]≠{}, n++];AppendTo[s,n],{100}];s
  • 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, an1, an, minan = {0, 1}, 0, 1, 2
        yield from [0, 1]
        while True:
            an1, an, s = an, minan, set(str(an1))
            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)
            yield an
            while minan in aset: minan += 1
    print(list(islice(agen(), 75))) # Michael S. Branicky, Jun 30 2022

A331215 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 23, 14, 20, 13, 24, 15, 26, 17, 25, 16, 27, 18, 29, 30, 12, 34, 19, 28, 31, 40, 21, 35, 41, 32, 45, 36, 42, 37, 46, 38, 47, 39, 48, 50, 43, 51, 49, 52, 60, 53, 61, 54, 62, 57, 63, 58, 64, 59, 67, 80, 56, 70, 81, 65, 71, 68, 72, 69, 73, 82, 74, 83, 75, 84, 76, 85, 79, 86, 102
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 03 2020

Keywords

Comments

This is not A276766, though the first 63 terms are the same.

Examples

			The four digits of a(11) = 23 and a(12) = 14 are distinct;
the four digits of a(12) = 14 and a(13) = 20 are distinct;
but so are also the successive digits 3,1,4,2 visible in 23, 14, 20;
the four digits of a(13) = 20 and a(14) = 13 are distinct;
the four digits of a(14) = 13 and a(15) = 24 are distinct;
but so are also the successive digits 0,1,3,2 visible in 20,13,24; etc.
		

Crossrefs

Cf. A331975 (a variant with 3 successive distinct digits instead of 4), A276766.

Programs

  • Python
    from itertools import islice
    def ok(s): return all(len(set(s[i:i+4]))==4 for i in range(len(s)-3))
    def agen(): # generator of terms
        aset, s, k, mink = {1}, "xy1", 1, 2
        while True:
            yield k
            k, avoid = mink, set(s)
            while k in aset or not ok(s + str(k)): k += 1
            aset.add(k)
            s = (s + str(k))[-4:]
            while mink in aset: mink += 1
    print(list(islice(agen(), 79))) # Michael S. Branicky, Jun 30 2022
Showing 1-3 of 3 results.