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!)
A360751 a(n) is the least perfect square average of two consecutive primes with 2*n gap between them, or -1 if no such number exists. 0
4, 9, 64, -1, 144, 625, 324, 2601, -1, 154449, 260100, 1681, 898704, 27225, 114244, -1, 278784, 223729, 4410000, 25281, 12888100, 4730625, 1512900, 4774225, -1, 8208225, 6130576, 1121481, 12744900, 34586161, 2433600, 45360225, 9784384, 1271279025, 64064016, -1, 69956496 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
For n > 1, no prime gap that is twice a square can have a perfect square in its middle as the average of the two consecutive primes with that gap between them. It is because then the lesser of the candidate consecutive primes could be factored into a composite of two integers greater than 1, by the algebraic identity a^2 - b^2 = (a - b)*(a + b).
LINKS
EXAMPLE
a(3) = 64 is a term because 64 = 8^2, a perfect square, which is the least such number that is the average of two consecutive primes 61 and 67, with 2*3 = 6 being the prime gap between them.
MATHEMATICA
seq[len_, pmax_] := Module[{s = Table[0, {len}], p = 3, c = 0, q, m, d}, Do[s[[i^2]] = -1; c++, {i, 2, Floor[Sqrt[len]]}]; While[c < len && p < pmax, q = NextPrime[p]; d = (q - p)/2; m = (p + q)/2; If[d <= len && s[[d]] == 0 && IntegerQ[Sqrt[m]], c++; s[[d]] = m]; p = q]; s]; seq[20, 10^7] (* Amiram Eldar, Feb 19 2023 *)
PROG
(PARI) a(n) = if ((n>1) && issquare(n), return(-1)); forprime(p=2, oo, my(q=nextprime(p+1), s); if ((q-p == 2*n) && issquare(s=(p+q)/2), return(s))); \\ Michel Marcus, Feb 20 2023
CROSSREFS
Sequence in context: A028908 A265148 A220445 * A073658 A059479 A094083
KEYWORD
sign
AUTHOR
Tamas Sandor Nagy, Feb 19 2023
EXTENSIONS
More terms from Amiram Eldar, Feb 19 2023
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 May 14 17:50 EDT 2024. Contains 372533 sequences. (Running on oeis4.)