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-1 of 1 results.

A372408 a(n) = smallest composite not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1; a(1)=1.

Original entry on oeis.org

1, 4, 6, 8, 9, 39, 30, 10, 12, 14, 15, 16, 18, 28, 20, 21, 22, 24, 25, 26, 27, 57, 50, 40, 42, 32, 33, 34, 35, 36, 38, 48, 44, 45, 46, 49, 69, 60, 62, 52, 51, 54, 55, 56, 58, 68, 63, 64, 65, 66, 76, 70, 72, 74, 75, 77, 78, 88, 80, 81, 82, 84, 85, 86, 87, 187, 117, 110, 100, 102, 104, 105, 106, 108, 118, 111, 112
Offset: 1

Views

Author

Keywords

Comments

The sequence is a permutation of the nonprimes.

Examples

			The Levenshtein distance = 1 between 1 and 4, 4 and 6, 6 and 8, 8 and 9, 9 and 39, 39 and 30, 30 and 10, etc.
No smaller composite than 39 was possible for a(6).
		

Crossrefs

Programs

  • Mathematica
    a[1]=1;a[n_]:=a[n]=(k=2;While[PrimeQ@k||MemberQ[Array[a,n-1],k]|| EditDistance[ToString@k,ToString@a[n-1]]!=1,k++];k);Array[a,77]
  • Python
    from sympy import isprime
    from itertools import islice
    from Levenshtein import distance as Ld
    def agen(): # generator of terms
        an, aset, mink = 1, {1}, 4
        while True:
            yield an
            s, k = str(an), mink
            while k in aset or Ld(s, str(k)) != 1 or isprime(k): k += 1
            an = k
            aset.add(k)
            while mink in aset or isprime(mink): mink += 1
    print(list(islice(agen(), 80))) # Michael S. Branicky, Apr 29 2024
Showing 1-1 of 1 results.