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.
%I A372407 #15 May 12 2024 11:46:45 %S A372407 2,3,5,7,17,11,13,19,29,23,43,41,31,37,47,67,61,71,73,53,59,79,89,83, %T A372407 283,223,227,127,107,101,103,109,139,131,137,157,151,181,191,193,113, %U A372407 163,167,197,97,397,307,317,311,211,241,251,257,277,271,281,881,811,821,421,401,409,419,439 %N A372407 a(n) = smallest prime not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1. %C A372407 The sequence is a permutation of the prime numbers. %H A372407 Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2024/04/prime-padlock.html">Prime combination lock</a>, Personal blog, April 2024. %e A372407 The Levenshtein distance = 1 between 2 and 3, 3 and 5, 5 and 7, 7 and 17, 17 and 11, 11 and 13, etc. %e A372407 No smaller prime than 17 was possible for a(5). %t A372407 a[1]=2;a[n_]:=a[n]=(k=2;While[MemberQ[Array[a,n-1],k]|| EditDistance[ToString@k, ToString@a[n-1]]!=1,k=NextPrime@k];k);Array[a,68] %o A372407 (Python) %o A372407 from sympy import isprime %o A372407 from itertools import islice %o A372407 from Levenshtein import distance as Ld %o A372407 def agen(): # generator of terms %o A372407 an, aset, mink = 2, {2}, 3 %o A372407 while True: %o A372407 yield an %o A372407 s, k = str(an), mink %o A372407 while k in aset or Ld(s, str(k)) != 1 or not isprime(k): k += 1 %o A372407 an = k %o A372407 aset.add(k) %o A372407 while mink in aset or not isprime(mink): mink += 1 %o A372407 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Apr 29 2024 %Y A372407 Cf. A000040, A118763, A372408. %K A372407 base,nonn %O A372407 1,1 %A A372407 _Eric Angelini_ and _Giorgos Kalogeropoulos_, Apr 29 2024