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

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).

Original entry on oeis.org

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

Views

Author

Eric Angelini and M. F. Hasler, Nov 01 2014

Keywords

Crossrefs

Programs

  • 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
  • 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! */

A342356 a(1) = 1, a(2) = 10; for n > 2, a(n) is the least positive integer not occurring earlier that shares both a factor and a digit with a(n-1).

Original entry on oeis.org

1, 10, 12, 2, 20, 22, 24, 4, 14, 16, 6, 26, 28, 8, 18, 15, 5, 25, 35, 30, 3, 33, 36, 32, 34, 38, 48, 40, 42, 21, 27, 57, 45, 50, 52, 54, 44, 46, 56, 58, 68, 60, 62, 64, 66, 63, 39, 9, 69, 90, 70, 7, 77, 147, 49, 84, 74, 37, 333, 93, 31, 124, 72, 75, 51, 17, 102, 80, 78, 76, 86, 82, 88, 98, 91
Offset: 1

Views

Author

Scott R. Shannon, Mar 08 2021

Keywords

Comments

After 100000 terms the lowest unused number is 18181. The sequence is likely a permutation of the positive integers.

Crossrefs

Cf. A342366 (share factor but not digit), A239664 (no shared factor or digit), A342367 (share digit but not factor), A184992, A309151, A249591.

Programs

  • Mathematica
    Block[{a = {1, 10}, m = {1, 0}, k}, Do[k = 2; While[Nand[FreeQ[a, k], GCD[k, a[[-1]]] > 1, IntersectingQ[m, IntegerDigits[k]]], k++]; AppendTo[a, k]; Set[m, IntegerDigits[k]], {i, 73}]; a] (* Michael De Vlieger, Mar 11 2021 *)
  • Python
    from sympy import factorint
    def aupton(terms):
      alst, aset = [1, 10], {1, 10}
      for n in range(3, terms+1):
        an = 1
        anm1_digs, anm1_factors = set(str(alst[-1])), set(factorint(alst[-1]))
        while True:
          while an in aset: an += 1
          if set(str(an)) & anm1_digs != set():
            if set(factorint(an)) & anm1_factors != set():
              alst.append(an); aset.add(an); break
          an += 1
      return alst
    print(aupton(75)) # Michael S. Branicky, Mar 09 2021

A342366 a(1) = 1, a(2) = 2; for n > 2, a(n) is the least positive integer not occurring earlier that shares a factor but not a digit with a(n-1).

Original entry on oeis.org

1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 20, 14, 7, 21, 30, 15, 24, 16, 22, 11, 33, 18, 26, 13, 52, 34, 17, 68, 32, 40, 25, 60, 27, 36, 28, 35, 42, 38, 19, 57, 39, 45, 63, 48, 50, 44, 55, 66, 51, 69, 23, 46, 58, 29, 87, 54, 62, 31, 248, 56, 49, 70, 64, 72, 80, 65, 78, 90, 74, 82, 41, 205, 164, 88, 76, 84
Offset: 1

Views

Author

Scott R. Shannon, Mar 09 2021

Keywords

Comments

After 100000 terms the lowest unused number is 1523. It is unknown if the sequence is a permutation of the positive integers.

Crossrefs

Cf. A342356 (share factor and digit), A239664 (no shared factor or digit), A342367 (share digit but not factor), A184992, A309151, A249591.

Programs

  • Mathematica
    Block[{a = {1, 2}, m = {2}, k}, Do[k = 2; While[Nand[FreeQ[a, k], GCD[k, a[[-1]]] > 1, ! IntersectingQ[m, IntegerDigits[k]]], k++]; AppendTo[a, k]; Set[m, IntegerDigits[k]], {i, 74}]; a] (* Michael De Vlieger, Mar 11 2021 *)
  • Python
    from sympy import factorint
    def aupton(terms):
      alst, aset = [1, 2], {1, 2}
      for n in range(3, terms+1):
        an = 1
        anm1_digs, anm1_factors = set(str(alst[-1])), set(factorint(alst[-1]))
        while True:
          while an in aset: an += 1
          if set(str(an)) & anm1_digs == set():
            if set(factorint(an)) & anm1_factors != set():
              alst.append(an); aset.add(an); break
          an += 1
      return alst
    print(aupton(76)) # Michael S. Branicky, Mar 09 2021

A342367 a(1) = 1; for n > 1, a(n) is the least positive integer not occurring earlier that shares a digit but not a factor > 1 with a(n-1).

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Mar 09 2021

Keywords

Comments

After 100000 terms the lowest unused number is 99986. It is almost certain that this sequence is a permutation of the positive integers.

Crossrefs

Cf. A342356 (share factor and digit), A342366 (share factor but not digit), A239664 (no shared factor or digit), A184992, A309151, A249591.

Programs

  • Mathematica
    Block[{a = {1}, m = {1}, k}, Do[k = 2; While[Nand[FreeQ[a, k], GCD[k, a[[-1]]] == 1, IntersectingQ[m, IntegerDigits[k]]], k++]; AppendTo[a, k]; Set[m, IntegerDigits[k]], {i, 74}]; a] (* Michael De Vlieger, Mar 11 2021 *)
  • Python
    from sympy import factorint
    def aupton(terms):
      alst, aset = [1], {1}
      for n in range(2, terms+1):
        an = 1
        anm1_digs, anm1_factors = set(str(alst[-1])), set(factorint(alst[-1]))
        while True:
          while an in aset: an += 1
          if set(str(an)) & anm1_digs != set():
            if set(factorint(an)) & anm1_factors == set():
              alst.append(an); aset.add(an); break
          an += 1
      return alst
    print(aupton(74)) # Michael S. Branicky, Mar 09 2021
Showing 1-5 of 5 results.