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.

A237885 a(n) is the number of ways that 4n can be written as p+q (p>q) with p, q, (p-q)/2, 4n-(p-q)/2 all prime numbers.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 0, 0, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 1, 0, 4, 0, 0, 2, 0, 1, 1, 0, 1, 2, 0, 0, 2, 0, 0, 3, 0, 0, 2, 0, 1, 1, 0, 0, 2, 0, 0, 1, 0, 0, 5, 0, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 3, 0, 0, 2, 0, 1, 3, 0, 0, 3, 1, 0, 3
Offset: 1

Views

Author

Lei Zhou, Feb 14 2014

Keywords

Comments

2n=q+(p-q)/2; 6n=p+(4n-(p-q)/2).
Number of ways that 2*n can be written as a+b with aRobert Israel, Jun 07 2022

Examples

			When n=4, 4n=16, 16=13+3, (13-3)/2=5, 16-5=11, all four numbers {3, 5, 11, 13} are prime numbers.  There is no other such four number set with this property, so a(4)=1;
When n=30, 4n=120.
  120=113+7, (113-7)/2=53, 120-53=67.  Set 1: {7, 53, 67, 113}.
  120=109+11, (109-11)/2=49=7*7, X
  120=107+13, (107-13)/2=47, 120-47=73. Set 2: {13, 47, 73, 107}.
  120=103+17, (103-17)/2=43, 120-43=77=7*11, X
  120=101+19, (101-19)/2=41, 120-41=79. Set 3: {19, 41, 79, 101}.
  120=97+23, (97-23)/2=37, 120-37=83. Set 4: {23, 37, 83, 97}.
  120=89+31, (89-31)/2=29, 120-29=91=7*13, X
  120=83+37, same with Set 4.
  120=79+41, same with Set 3.
  120=73+47, same with Set 2.
  120=67+53, same with Set 1.
  120=61+59, (61-59)/2=1, X
  So four acceptable sets have been found, and therefore a(30)=4.
		

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    V:= Vector(N):
    P:= select(isprime, [seq(i,i=3..2*N,2)]):
    nP:= nops(P):
    for i from 1 to nP do
      p:= P[i];
      for j from i+1 to nP do
        q:= P[j];
        if p+q > 2*N then break fi;
        r:= (p+q)/2;
        if isprime(p+2*q) and isprime(2*p+q) then
          V[r]:= V[r]+1
        fi
      od
    od:
    convert(V,list); # Robert Israel, Jun 08 2022
  • Mathematica
    Table[qn = 4*n; p = 2*n - 1; ct = 0; While[p = NextPrime[p]; p < qn, q = qn - p; If[PrimeQ[q] && PrimeQ[(p - q)/2] && PrimeQ[qn - (p - q)/2], ct++]]; ct/2, {n, 1, 87}]4*n-1
  • PARI
    a(n)=my(s);forprime(p=2,n,if(isprime(2*n-p) && isprime(2*n+p) && isprime(4*n-p), s++)); s \\ Charles R Greathouse IV, Mar 15 2015