OFFSET
1,1
COMMENTS
a(n) is the least prime p such that A260870((p-1)/2) = n.
LINKS
Robert Israel, Table of n, a(n) for n = 1..220
EXAMPLE
a(3) = 13 because 13 is prime, 3^2 + (13-3)^2 = 109 is prime, and both 1^2 + (13-1)^2 = 145 and 2^2 + (13-2)^2 = 125 are composite, and no smaller prime works.
MAPLE
N:= 100: # for a(1) .. a(N)
f:= proc(p) local k;
for k from 1 to p/2 do if isprime(k^2 + (p-k)^2) then return k fi od;
FAIL
end proc:
V:= Vector(N): count:= 0: p:= 0:
for i from 1 while count < N do
p:= nextprime(p);
v:= fp(p);
if v <= N and V[v] = 0 then V[v]:= p; count:= count+1 fi
od:
convert(V, list);
PROG
(Python)
from sympy import isprime, nextprime
def A376920(n):
p = n
while (p:=nextprime(p)):
if isprime(n**2+(p-n)**2) and not any(isprime(k**2+(p-k)**2) for k in range(1, min(n-1, p//2)+1)):
return p # Chai Wah Wu, Oct 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Oct 10 2024
STATUS
approved