login
A342821
a(n) is the least prime p such that p*n+(n-1) and p*n-(n-1) are both prime, or 0 if there is no such p.
2
2, 2, 3, 2, 3, 2, 5, 3, 5, 2, 3, 29, 7, 0, 3, 2, 0, 2, 11, 3, 3, 5, 0, 19, 5, 3, 29, 2, 0, 2, 13, 0, 3, 29, 3, 2, 41, 0, 5, 11, 3, 11, 5, 0, 5, 2, 0, 3, 5, 3, 19, 19, 3, 11, 7, 3, 11, 2, 0, 2, 7, 0, 3, 5, 0, 2, 5, 3, 11, 5, 0, 19, 13, 0, 31, 7, 0, 2, 19, 0, 7, 11, 3, 5, 19, 0, 5, 2, 0, 3, 7, 0, 5
OFFSET
1,1
COMMENTS
If n == 2 (mod 3) then a(n) <= 3.
LINKS
EXAMPLE
a(7) = 5 because 5*7+6 = 41 and 5*7-6 = 29 are prime, and 5 is the least prime that works.
MAPLE
f:= proc(n) local p, pmax;
p:= 1:
if n mod 3 = 2 then pmax := 3 else pmax := infinity fi;
while p < pmax do
p:= nextprime(p);
if isprime(n*p+n-1) and isprime(n*p-n+1) then return p fi;
od:
0
end proc:
map(f, [$1..100]);
CROSSREFS
Cf. A342822.
Sequence in context: A331597 A356231 A339502 * A165916 A096013 A072380
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Apr 25 2021
STATUS
approved