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.

A076471 Number of pairs (p,q) of successive primes with p+q<=n.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 14 2002

Keywords

Examples

			Pairs (p,q) of successive primes with p+q<=27: {(2,3), (3,5), (5,7), (7,11), (11,13)}, hence a(27)=5.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p;
      if n <= 4 then return 0 fi;
      p:= prevprime(ceil(n/2));
      if p + nextprime(p) <= n then numtheory:-pi(p) else numtheory:-pi(p)-1 fi
    end proc:
    map(f, [$1..100]); # Robert Israel, Dec 08 2024
  • Mathematica
    With[{t=Total/@Partition[Prime[Range[100]],2,1]},Table[Count[t,?(#<=n&)],{n,100}]] (* _Harvey P. Dale, Apr 16 2015 *)

Formula

A056172(n)-1 <= a(n) <= A056172(n).
a(n) = A076472(n) + A076473(n).