login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A345906
Numbers with at least 4 digits such that any 3-digit substring forms a prime number.
0
1011, 1013, 1017, 1019, 1031, 1037, 1071, 1073, 1079, 1097, 1131, 1137, 1139, 1271, 1277, 1311, 1313, 1317, 1373, 1379, 1397, 1491, 1499, 1571, 1577, 1631, 1673, 1677, 1733, 1739, 1797, 1811, 1911, 1919, 1937, 1971, 1977, 1991, 1997, 2113, 2233, 2239, 2271, 2277, 2293
OFFSET
1,1
COMMENTS
Only numbers greater than 1000 are considered, since all 3-digit primes are trivial members.
A211684 is a similar sequence that doesn't allow leading zeros in substrings.
EXAMPLE
1011 belongs to the sequence as both 101 and 011=11 are primes.
MAPLE
q:= n-> (s-> andmap(isprime@parse, [seq(s[j-2..j], j=3..length(s))]))(""||n):
select(q, [$1000..2300])[]; # Alois P. Heinz, Jun 29 2021
MATHEMATICA
Select[Range[1000, 3000], PrimeQ[FromDigits[Take[IntegerDigits[#], -3]]] && PrimeQ[FromDigits[Take[IntegerDigits[#], 3]]] &]
PROG
(Python)
from sympy import isprime
def ok(n):
if n <= 1000: return False
s = str(n)
return all(isprime(int(s[i:i+3])) for i in range(len(s)-2))
print(list(filter(ok, range(1001, 2300)))) # Michael S. Branicky, Jun 29 2021
CROSSREFS
Sequence in context: A235775 A262865 A213315 * A035125 A183849 A185881
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, Jun 29 2021
STATUS
approved