[go: up one dir, main page]

login
A354589
Primes p starting a sequence of 4 consecutive primes whose final digits are 1,3,7,9 (in any order)
2
11, 23, 47, 53, 67, 83, 89, 101, 109, 149, 167, 191, 193, 197, 199, 211, 251, 257, 263, 383, 443, 449, 461, 487, 557, 563, 587, 593, 599, 613, 647, 659, 739, 757, 761, 821, 859, 983, 991, 1061, 1063, 1069, 1117, 1217, 1223, 1283, 1301, 1303, 1367, 1433, 1439, 1447, 1481, 1553, 1567, 1571, 1579
OFFSET
1,1
LINKS
EXAMPLE
a(3) = 47 is in the sequence because the 4 consecutive primes starting with 47 are 47, 53, 59, 61, and their final digits 7,3,9,1 are a permutation of 1,3,7,9.
MAPLE
P:= select(isprime, [seq(i, i=3..2000, 2)]):
P1:= P mod 10:
P[select(i -> convert(P1[i..i+3], set) = {1, 3, 7, 9}, [$1..nops(P)-3])];
MATHEMATICA
Select[Partition[Prime[Range[300]], 4, 1], Sort[Mod[#, 10]] == {1, 3, 7, 9} &][[;; , 1]] (* Amiram Eldar, Aug 19 2022 *)
PROG
(Python)
from sympy import nextprime
from itertools import islice
def agen(): # generator of terms
p = [2, 3, 5, 7]
while True:
if set(map(lambda x: x%10, p)) == {1, 3, 7, 9}: yield p[0]
p = p[1:] + [nextprime(p[-1])]
print(list(islice(agen(), 60))) # Michael S. Branicky, Aug 18 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Aug 18 2022
STATUS
approved