The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 8 00:08 EDT 2024. Contains 373206 sequences. (Running on oeis4.)