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.

A270003 Least prime p such that n = p + q - r for some primes q and r with q > p.

Original entry on oeis.org

3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 3, 2
Offset: 1

Views

Author

Clark Kimberling, Apr 26 2016

Keywords

Comments

p = 3 when n is an odd nonprime and p = 2 otherwise, so that 3 appears in positions given by A014076.

Examples

			n   p   q   r
1   3   5   7
2   2   3   3
3   2   3   2
4   2   5   3
5   2   5   2
6   2   7   3
7   2   7   2
		

Crossrefs

Programs

  • Mathematica
    t = Join[{{1, {3, 5, 7}}, {2, {2, 3, 3}}}, Table[If[PrimeQ[n], {n, {2, n, 2}}, p = If[EvenQ[2 + NextPrime[n, 1] - n], 3, 2]; NestWhile[# + 1 &, 1, ! PrimeQ[r = (p + (q = NextPrime[n, #])) - n] &]; {n, {p, q, r}}], {n, 3, 300}]];
    Map[#[[2]][[1]] &, t] (* p, A270003 *)
    Map[#[[2]][[2]] &, t] (* q, A270753 *)
    Map[#[[2]][[3]] &, t] (* r, A271353 *)
    (* Peter J. C. Moses, Apr 26 2016 *)
  • PARI
    a(n)=if(n%2 && !isprime(n), 3, 2) \\ Charles R Greathouse IV, Apr 29 2016