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.

A114230 Largest prime p < prime(n) such that prime(n) + 2 * p is a prime.

Original entry on oeis.org

2, 3, 5, 3, 5, 13, 17, 19, 19, 29, 23, 31, 29, 31, 43, 19, 59, 53, 61, 59, 59, 79, 67, 83, 61, 89, 103, 101, 109, 113, 109, 97, 131, 109, 149, 137, 149, 127, 163, 139, 149, 109, 149, 163, 197, 191, 197, 223, 227, 229, 211, 239, 241, 241, 223, 241, 269, 233, 271, 269
Offset: 2

Views

Author

Lei Zhou, Nov 18 2005

Keywords

Examples

			prime(2)=3, 3+2*2=7 is prime, so a(2)=2;
prime(3)=5, 5+2*3=11 is prime, so a(3)=3;
...
prime(11)=31, 31+2*29=89 is prime, so a(11)=29.
		

Crossrefs

Programs

  • Haskell
    a114230 n = head [p | let q = a000040 n,
                          p <- reverse $ takeWhile (< q) a000040_list,
                          a010051 (q + 2 * p) == 1]
    -- Reinhard Zumkeller, Oct 29 2013
  • Mathematica
    Table[p1 = Prime[n1]; n2 = n1 - 1; p2 = Prime[n2]; While[cp = p1 + 2*p2; ! PrimeQ[cp], n2--; If[n2 == 0, Print[n1]]; p2 = Prime[n2]]; p2, {n1, 2, 201}]
    lp[n_]:=Module[{p=NextPrime[n,-1]},While[!PrimeQ[n+2p],p=NextPrime[p,-1]];p]; Table[lp[p],{p,Prime[Range[2,70]]}] (* Harvey P. Dale, Jan 17 2022 *)

Extensions

Edited definition to conform to OEIS style. - Reinhard Zumkeller, Oct 29 2013