login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A372408 a(n) = smallest composite not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1; a(1)=1. 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
The sequence is a permutation of the nonprimes.
LINKS
Eric Angelini, Prime combination lock, Personal blog, April 2024.
EXAMPLE
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).
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]
PROG
(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
CROSSREFS
Sequence in context: A099071 A156673 A073866 * A202260 A001744 A113624
KEYWORD
nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 8 01:56 EDT 2024. Contains 374149 sequences. (Running on oeis4.)