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-4 of 4 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

A276633 a(n) = smallest integer not yet in the sequence with no digits in common with a(n-1) and 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, 22, 33, 11, 20, 34, 15, 26, 30, 14, 25, 36, 17, 24, 35, 16, 27, 38, 19, 40, 23, 18, 44, 29, 13, 45, 28, 31, 46, 50, 12, 37, 48, 21, 39, 47, 51, 32, 49, 55, 60, 41, 52, 63, 70, 42, 53, 61, 72, 43, 56, 71, 80, 54, 62, 73, 58, 64, 77, 59, 66, 74, 81, 65, 79
Offset: 0

Views

Author

Zak Seidov and Eric Angelini, Sep 08 2016

Keywords

Comments

The sequence is not a permutation of the positive integers. E.g., 123456789 and 1023456789 (the smallest pandigital number) are not members.
Numbers n such that a(n)=n: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 52, 147, 1619, 6140, ...
The sequence is infinite, since all digits in a(n-3) are allowed in a(n). - Robert Israel, Sep 20 2016

Examples

			From _David A. Corneth_, Sep 22 2016: (Start)
Each number can consist of 2^10-1 sets of distinct digits, i.e., classes. For example, 21132 is in the class {1, 2, 3}. We don't include a number without digits. For this sequence, we can also exclude numbers with only the digit 0. This leaves 1022 classes. We create a list with a place for each class containing the least number from that class not already in the sequence.
To illustrate the algorithm used to create the current b-file, we'll (for brevity) assume we've already calculated all terms for n = 1 to 100 and that we already know which classes will be used to compute the next 10 terms, for n = 101 to 110.
These classes are:  {0, 1}, {2, 3}, {5, 9}, {7, 9}, {8, 9}, {0, 1, 6}, {0, 1, 7}, {2, 2, 2} and {2, 2, 4} having the values 110, 223, 95, 97, 89, 106, 107, 222 and 224. a(99) = 104 and a(100) = 88, so from those values we may only choose from {223, 95, 97 and 222}. The least value in the list is 95. Therefore, a(101) = 95. The number for the class is now replaced with the next larger number having digits {5, 9} (=A276769(95)), being 559.
(One may see that in the example I only listed 9 classes. Class {8, 9} occurs twice in the example; a(104) = 89 and a(107) = 98.)
From a list of computed values up to some n, the values for classes may be updated to compute further. E.g., to compute a(20000), one may use the b-file to find the least number not already in the sequence for each class and then proceed from a(19998) and a(19999), etc. (End)
		

Crossrefs

Programs

  • Maple
    N:= 10^3: # to get all terms before the first > N
    for R in combinat:-powerset({$0..9}) minus {{},{$0..9}} do
      Lastused[R]:= [];
      MR[R]:= Array[0..9];
      for i from 1 to nops(R) do MR[R][R[i]]:= i od:
    od:
    A[0]:= 0: A[1]:= 1:
    S:= {0,1}:
    for n from 2 to N do
      R:= {$0..9} minus (convert(convert(A[n-1],base,10),set) union convert(convert(A[n-2],base,10),set));
      L:= Lastused[R];
      x:= 0;
      while member(x,S) do
        for d from 1 do
          if d > nops(L) then
            if R[1] = 0 then L:= [op(L),R[2]] else L:= [op(L),R[1]] fi;
            break
          elif L[d] < R[-1] then
            L[d]:= R[MR[R][L[d]]+1]; break
          else
            L[d]:= R[1];
          fi
        od;
        x:= add(L[j]*10^(j-1),j=1..nops(L));
      od;
      A[n]:= x;
      S:= S union {x};
      Lastused[R] := L;
    od:
    seq(A[i],i=0..N); # Robert Israel, Sep 20 2016
  • Mathematica
    s={0,1};Do[a=s[[-2]];b=s[[-1]];n=2;idab=Union[IntegerDigits[a],IntegerDigits[b]]; While[MemberQ[s,n]|| Intersection[idab,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(an) + 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

A239664 a(n) = 1, a(n+1) = smallest number not occurring earlier, having with a(n) neither a common digit nor a common divisor.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 23 2014

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (delete, intersect); import Data.Function (on)
    a239664 n = a239664_list !! (n-1)
    a239664_list = 1 : f 1 [2..] where
       f v ws = g ws where
         g (x:xs) = if gcd v x == 1 && ((intersect `on` show) v x == "")
                       then x : f x (delete x ws) else g xs
    
  • PARI
    {u=[]; a=1; for(n=1,99, print1(a","); u=setunion(u,[a]); while(#u>1&&u[2]==u[1]+1,u=u[^1]); for(k=u[1]+1,9e9, setsearch(u,k)&&next;gcd(k,a)>1&&next; #setintersect(Set(digits(a)),Set(digits(k)))&&next; a=k; next(2)));a} \\ M. F. Hasler, Sep 17 2016

A276766 a(n) = smallest nonnegative integer not yet in the sequence with no repeated digits and no digits in common with a(n-1), starting with a(0)=0.

Original entry on oeis.org

0, 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, 65, 71, 68, 72, 69, 73, 81, 74, 82, 75
Offset: 0

Views

Author

Claudio Meller, Sep 17 2016

Keywords

Comments

The author of this sequence is Rodolfo Kurchan, who mentioned this sequence in a Facebook Group "Series", cf. link.
The sequence is finite, with last term a(5274) = 78642. - M. F. Hasler, Sep 17 2016

Crossrefs

Programs

  • PARI
    {u=[]; (t(k)=if(#Set(k=digits(k))==#k,k)); a=1; for(n=1, 99, print1(a","); u=setunion(u, [a]); t(u[1])||u[1]++; while(#u>1&&u[2]<=u[1]+1, u=u[^1]); for(k=u[1]+1, 9e9, setsearch(u, k)&&next; (d=t(k))&& !#setintersect(Set(digits(a)), Set(d))&&(a=k)&&next(2))); a} \\ M. F. Hasler, Sep 17 2016
    
  • Python
    def ok(s, t): return len(set(t)) == len(t) and len(set(s+t)) == len(s+t)
    def agen(): # generator of complete sequence of terms
        aset, k, mink, MAX = {0}, 0, 1, 987654321
        while True:
            if k < MAX: yield k
            else: return
            k, s = mink, str(k)
            MAX = 10**(10-len(s))
            while k < MAX and (k in aset or not ok(s, str(k))):
                k += 1
            aset.add(k)
            while mink in aset: mink += 1
    print(list(agen())[:73]) # Michael S. Branicky, Jun 30 2022

Extensions

Edited by M. F. Hasler, Sep 17 2016
Showing 1-4 of 4 results.