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-2 of 2 results.

A092938 a(n) = least prime p such that 2*prime(n) - p is prime.

Original entry on oeis.org

2, 3, 3, 3, 3, 3, 3, 7, 3, 5, 3, 3, 3, 3, 5, 3, 5, 13, 3, 3, 7, 7, 3, 5, 3, 3, 7, 3, 7, 3, 3, 5, 3, 7, 5, 19, 3, 13, 3, 29, 5, 3, 3, 3, 5, 19, 3, 3, 5, 19, 3, 11, 3, 3, 5, 3, 17, 19, 7, 5, 3, 17, 7, 3, 7, 3, 3, 13, 3, 7, 5, 17, 7, 3, 7, 5, 5, 7, 5, 7, 11, 3, 3, 3, 19, 3, 11, 3, 3, 7, 5, 5, 3, 5, 7, 23, 5, 3
Offset: 1

Views

Author

Amarnath Murthy, Mar 23 2004

Keywords

Comments

a(n) = least prime p such that prime(n) = (p+q)/2, where q is also prime.
a(n) <= prime(n). Conjecture: a(n) = prime(n) only for n = 1 and 2.

Examples

			2*prime(8) = 38; 38 - 2 = 36, 38 - 3 = 35, 38 - 5 = 33 are composite, but 38 - 7 = 31 is prime. Hence a(8) = 7.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local pn,p;
       pn:= ithprime(n);
       p:= 1;
       do
         p:= nextprime(p);
         if isprime(2*pn-p) then return p fi
       od
    end proc:
    map(f, [$1..100]); # Robert Israel, Jul 31 2020
  • Mathematica
    a[n_] := Module[{p, q = Prime[n]}, For[p = 2, True, p = NextPrime[p], If[PrimeQ[2q-p], Return[p]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 07 2023 *)
  • PARI
    {for(n=1, 98, k=2*prime(n); p=2; while(!isprime(k-p), p=nextprime(p+1)); print1(p,","))} \\ Klaus Brockhaus, Dec 23 2006

Extensions

Edited and extended by Klaus Brockhaus, Dec 23 2006

A092940 a(n) = largest prime p such that 2*prime(n) - p is prime.

Original entry on oeis.org

2, 3, 7, 11, 19, 23, 31, 31, 43, 53, 59, 71, 79, 83, 89, 103, 113, 109, 131, 139, 139, 151, 163, 173, 191, 199, 199, 211, 211, 223, 251, 257, 271, 271, 293, 283, 311, 313, 331, 317, 353, 359, 379, 383, 389, 379, 419, 443, 449, 439, 463, 467, 479, 499, 509, 523
Offset: 1

Views

Author

Amarnath Murthy, Mar 23 2004

Keywords

Comments

a(n) = largest prime p such that prime(n) = (p+q)/2, where q is also prime.
prime(n) <= a(n) < 2*prime(n).
Conjecture: a(n) = prime(n) only for n = 1 and 2.

Examples

			2*prime(18) = 122; the primes smaller than 122 are 113, 109, 107, ... in descending order. 122 - 113 = 9 is not prime, but 122 - 109 = 13 is prime, hence a(18) = 109.
		

Crossrefs

Programs

  • PARI
    {for(n=1,56,k=2*prime(n);q=2;while(!isprime(p=k-q),q=nextprime(q+1));print1(p,","))} \\ Klaus Brockhaus, Dec 23 2006

Formula

a(n) = 2*prime(n) - A092938(n).

Extensions

Edited and extended by Klaus Brockhaus, Dec 23 2006
Showing 1-2 of 2 results.