login

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”).

A358804
a(n) is the least nonnegative integer k such that (k^2 + prime(n)^2)/2 is prime but (k^2 + prime(i)^2)/2 is not prime for i < n.
0
0, 1, 3, 15, 31, 45, 143, 81, 233, 151, 71, 353, 141, 537, 457, 1663, 209, 391, 707, 1081, 1877, 1161, 3807, 2361, 5657, 1399, 2783, 2967, 3149, 2923, 5103, 1109, 11937, 7211, 2341, 9311, 6837, 10303, 24933, 8273, 11821, 9931, 11191, 6377, 14007, 48111, 12821, 43967, 27563, 17171, 38157, 16859
OFFSET
1,3
FORMULA
A358790((a(n)-1)/2) = prime(n) for n > 1.
EXAMPLE
a(4) = 15 because prime(4) = 7 and (15^2 + 7^2)/2 = 137 is prime while (15^2 + p^2)/2 is not prime for primes p < 7, and 15 is the least number that works.
MAPLE
g:= proc(n) local s, p;
s:= n^2; p:= 2;
do
p:= nextprime(p);
if isprime((s+p^2)/2) then return p fi
od
end proc:
N:= 100: # for a(1)..a(N)
M:= ithprime(N): V:= Vector(M, -1):
count:= 1: V[2]:= 0:
for n from 1 by 2 while count < N do
v:= g(n); if v <= M and V[v] = -1 then V[v]:= n; count:= count+1 fi;
od:
seq(V[ithprime(i)], i=1..N);
MATHEMATICA
a[n_] := Module[{p = Prime[n], k = 0}, While[! PrimeQ[(k^2 + p^2)/2] || AnyTrue[Prime[Range[n - 1]], PrimeQ[(k^2 + #^2)/2] &], k++]; k]; Array[a, 50] (* Amiram Eldar, Dec 01 2022 *)
CROSSREFS
Cf. A358790.
Sequence in context: A289970 A211002 A031039 * A152813 A184235 A086381
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Dec 01 2022
STATUS
approved