login
A353697
a(n) is the least prime p such that, if q is the next prime after p and d = q-p, then p-n*d, p+n*d, q-n*d and q+n*d are all prime.
1
47, 131641, 11, 2417, 53, 17, 8389, 53, 43, 167, 167, 1171, 137537, 167, 41, 557, 80111, 241, 5387, 131, 59, 6917, 13187, 59, 157, 2861, 887, 14251, 367, 229, 1367, 72767, 71, 257, 233, 163, 4297, 233, 149, 263, 257, 547, 4831, 1499, 101, 1217, 66191, 101, 647, 353, 919, 7759, 18553, 223, 971
OFFSET
1,1
LINKS
EXAMPLE
a(3) = 11 because p = 11 is prime, the next prime is q = 13, d = 2, and p-3*d = 5, p+3*d = 17, q-3*d = 7, and q+3*d = 19 are prime; and this is the least prime that works.
MAPLE
f:= proc(n) local p, q, c;
q:= 2:
do
p:= q; q:= nextprime(q); d:= q-p;
if isprime(p-n*d) and isprime(p+n*d) and isprime(q-n*d) and isprime(q+n*d) then return p fi
od;
end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_] := Module[{p = 2, q = 3, d = 1}, While[! AllTrue[{p - n*d, p + n*d, q - n*d, q + n*d}, # > 0 && PrimeQ[#] &], p = q; q = NextPrime[q]; d = q - p]; p]; Array[a, 55] (* Amiram Eldar, Sep 06 2022 *)
PROG
(Python)
from sympy import isprime, nextprime
def a(n):
p = nextprime(2*n); q = nextprime(p); d = q-p
while not all(isprime(t) for t in [p-n*d, p+n*d, q-n*d, q+n*d]):
p = q; q = nextprime(q); d = q-p
return p
print([a(n) for n in range(1, 56)]) # Michael S. Branicky, Sep 05 2022
CROSSREFS
Sequence in context: A093940 A237512 A224468 * A328364 A087533 A292071
KEYWORD
nonn,look
AUTHOR
J. M. Bergot and Robert Israel, Sep 05 2022
STATUS
approved