login
A376920
a(n) is the least prime p such that n^2 + (p-n)^2 is prime and k^2 + (p-k)^2 is composite for 1 <= k < n.
1
2, 19, 13, 53, 31, 71, 109, 263, 239, 167, 661, 439, 673, 1289, 1021, 2531, 3617, 5101, 1033, 3037, 2017, 4889, 4751, 3169, 887, 2521, 11467, 20143, 563, 1873, 9931, 2617, 9833, 12739, 7057, 78787, 58067, 10831, 29759, 22229, 62801, 65479, 12163, 20233, 16561, 87911, 26597, 28621, 148339, 44159
OFFSET
1,1
COMMENTS
a(n) is the least prime p such that A260870((p-1)/2) = n.
LINKS
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
Sequence in context: A370387 A128361 A096481 * A335363 A176618 A356477
KEYWORD
nonn
AUTHOR
Robert Israel, Oct 10 2024
STATUS
approved