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.

A367815 Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 5.

Original entry on oeis.org

0, 11111, 2, 10000, 3, 10001, 4, 10002, 5, 10003, 6, 10004, 7, 10005, 8, 10006, 9, 10007, 21, 10008, 22, 10009, 23, 10010, 24, 10011, 25, 10012, 26, 10013, 27, 10014, 28, 10015, 29, 10016, 32, 10017, 33, 10018, 34, 10019, 35, 10020, 31, 10022, 36, 10021, 37, 10023, 38, 10024, 39, 10025, 41, 10026, 43
Offset: 1

Views

Author

Keywords

Examples

			a(1) =     0 and a(2) = 11111 are separated by an Ld of 5
a(2) = 11111 and a(3) = 1   2 are separated by an Ld of 5
a(3) =     2 and a(4) = 10000 are separated by an Ld of 5
a(4) = 10000 and a(5) =     3 are separated by an Ld of 5, etc.
		

Crossrefs

Programs

  • Mathematica
    a[1]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]||EditDistance[ToString@a[n-1],ToString@k]!=5,k++];k);Array[a,57]
  • Python
    from itertools import islice
    from Levenshtein import distance as Ld
    def agen(): # generator of terms
        an, aset, mink = 0, {0}, 1
        while True:
            yield an
            s, k = str(an), mink
            while k in aset or Ld(s, str(k)) != 5: k += 1
            an = k
            aset.add(k)
            while mink in aset: mink += 1
    print(list(islice(agen(), 57))) # Michael S. Branicky, Dec 01 2023