|
|
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
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|