Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #15 Oct 14 2024 15:35:18
%S 2,19,13,53,31,71,109,263,239,167,661,439,673,1289,1021,2531,3617,
%T 5101,1033,3037,2017,4889,4751,3169,887,2521,11467,20143,563,1873,
%U 9931,2617,9833,12739,7057,78787,58067,10831,29759,22229,62801,65479,12163,20233,16561,87911,26597,28621,148339,44159
%N 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.
%C a(n) is the least prime p such that A260870((p-1)/2) = n.
%H Robert Israel, <a href="/A376920/b376920.txt">Table of n, a(n) for n = 1..220</a>
%e 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.
%p N:= 100: # for a(1) .. a(N)
%p f:= proc(p) local k;
%p for k from 1 to p/2 do if isprime(k^2 + (p-k)^2) then return k fi od;
%p FAIL
%p end proc:
%p V:= Vector(N): count:= 0: p:= 0:
%p for i from 1 while count < N do
%p p:= nextprime(p);
%p v:= fp(p);
%p if v <= N and V[v] = 0 then V[v]:= p; count:= count+1 fi
%p od:
%p convert(V,list);
%o (Python)
%o from sympy import isprime, nextprime
%o def A376920(n):
%o p = n
%o while (p:=nextprime(p)):
%o 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)):
%o return p # _Chai Wah Wu_, Oct 14 2024
%Y Cf. A260869, A260870.
%K nonn
%O 1,1
%A _Robert Israel_, Oct 10 2024