cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A304904 Greatest prime p such that 2*n^2 - p is prime.

Original entry on oeis.org

5, 13, 29, 47, 67, 79, 109, 157, 197, 239, 283, 331, 389, 443, 509, 571, 643, 719, 797, 877, 937, 1051, 1129, 1237, 1321, 1453, 1549, 1669, 1789, 1879, 2029, 2161, 2309, 2447, 2579, 2731, 2857, 3037, 3187, 3359, 3517
Offset: 2

Views

Author

Hugo Pfoertner, May 20 2018

Keywords

Comments

Each square > 1 can be written as the average of 2 primes p1 < p2. a(n) gives the greatest prime p2 such that n^2 = (p1 + p2) / 2. The corresponding p1 is provided in A304903.

Examples

			a(6) = 67 because 2*6^2 - 67 = 5 is prime whereas 72 - 71 = 1 is not a prime.
		

Crossrefs

Programs

  • PARI
    a304903(n) = forprime(p=3, , if(ispseudoprime(2*n^2-p), return(p)))
    a(n) = 2*n^2-a304903(n) \\ Felix Fröhlich, May 20 2018

Formula

a(n) = n^2 + A304905(n) = A304903(n) + 2*A304905(n).

A304905 Greatest difference d such that both n^2 - d and n^2 + d are primes.

Original entry on oeis.org

1, 4, 13, 22, 31, 30, 45, 76, 97, 118, 139, 162, 193, 218, 253, 282, 319, 358, 397, 436, 453, 522, 553, 612, 645, 724, 765, 828, 889, 918, 1005, 1072, 1153, 1222, 1283, 1362, 1413, 1516, 1587, 1678, 1753, 1842, 1917
Offset: 2

Views

Author

Hugo Pfoertner, May 20 2018

Keywords

Examples

			a(2) = 1 because 2^2 - 1 = 3 and 2^2 + 1 = 5 are primes.
a(7) = 30 because 7^2 - 30 = 19 and 7^2 + 30 = 79 is the pair with maximum difference. All greater differences lead to at least one composite, i.e., 49 + 32 = 81, 49 - 34 = 15, 49 + 36 = 85, 49 + 38 = 87, 49 - 40 = 9, 49 + 42 = 91 = 7*13, 49 + 44 = 93 = 3*31, 49 + 46 = 95, and 49 - 48 = 1 is not a prime.
		

Crossrefs

Programs

  • PARI
    a304903(n) = forprime(p=3, , if(ispseudoprime(2*n^2-p), return(p)))
    a(n) = n^2 - a304903(n) \\ Felix Fröhlich, May 20 2018

Formula

a(n) = (A304904(n) - A304903(n))/2 = n^2 - A304903(n) = A304904(n) - n^2.

A305125 Number of ways to express n^2 as average of two primes p1 < p2.

Original entry on oeis.org

0, 1, 2, 2, 4, 6, 3, 3, 10, 8, 8, 17, 9, 11, 27, 11, 12, 27, 14, 21, 39, 17, 19, 36, 28, 22, 48, 25, 24, 75, 30, 25, 68, 35, 56, 68, 37, 40, 93, 54, 43, 103, 42, 52, 125, 51, 49, 117, 64, 76, 130, 63, 56, 135, 99, 78, 151, 76, 73, 198
Offset: 1

Views

Author

Hugo Pfoertner, May 26 2018

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_]:=Length[Select[2 n - Prime[Range[2, PrimePi[n]]], PrimeQ]]; Table[f[n^2], {n, 60}] (* Vincenzo Librandi, May 26 2018 *)
  • PARI
    for (n=1,60,k=0;n2=2*n*n;forprime(p=3,n2/2,if(isprime(n2-p),k++));print1(k,", "))

Formula

a(n) = A002375(n^2).
Showing 1-3 of 3 results.