login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A304903 Least prime p such that 2*n^2 - p is prime. 3
3, 5, 3, 3, 5, 19, 19, 5, 3, 3, 5, 7, 3, 7, 3, 7, 5, 3, 3, 5, 31, 7, 23, 13, 31, 5, 19, 13, 11, 43, 19, 17, 3, 3, 13, 7, 31, 5, 13, 3, 11, 7, 19, 23, 3, 61, 5, 3, 7, 5, 61, 37, 5, 3, 3, 7, 19, 3, 7, 31, 7, 5, 13, 3, 5
(list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
COMMENTS
Each square > 1 can be written as the average of 2 primes p1 < p2. a(n) gives the least prime p1 such that n^2 = (p1 + p2) / 2. The corresponding p2 is provided in A304904.
LINKS
FORMULA
a(n) = n^2 - A304905(n) = A304904(n) - 2*A304905(n).
EXAMPLE
a(5) = 3 because 2*5^2 - 3 = 47 is prime,
a(7) = 19 because 2*7^2 - 19 = 71 is prime, whereas all of 98 - 3 = 95, 98 - 5 = 93, 98 - 7 = 91, 98 - 11 = 87, 98 - 13 = 85 and 98 - 17 = 81 are composite.
MATHEMATICA
f[n_] := Block[{p = 2}, While[ !PrimeQ[2 n^2 - p], p = NextPrime@ p]; p]; Array[f, 65, 2] (* Robert G. Wilson v, May 20 2018 *)
PROG
(PARI) a(n) = forprime(p=3, , if(ispseudoprime(2*n^2-p), return(p))) \\ Felix Fröhlich, May 20 2018
CROSSREFS
Sequence in context: A358790 A021287 A124887 * A097524 A073703 A175019
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, May 20 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | 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 September 18 15:46 EDT 2024. Contains 376000 sequences. (Running on oeis4.)