%I #18 Jun 08 2022 03:24:27
%S 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,
%T 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,
%U 0,0,0,4,0,0,3,0,0,2,0,1,3,0,0,3,1,0,3
%N 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.
%C 2n=q+(p-q)/2; 6n=p+(4n-(p-q)/2).
%C Number of ways that 2*n can be written as a+b with a<b and a, b, a+2*b and 2*a+b all prime. - _Robert Israel_, Jun 07 2022
%H Lei Zhou, <a href="/A237885/b237885.txt">Table of n, a(n) for n = 1..10000</a>
%e 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;
%e When n=30, 4n=120.
%e 120=113+7, (113-7)/2=53, 120-53=67. Set 1: {7, 53, 67, 113}.
%e 120=109+11, (109-11)/2=49=7*7, X
%e 120=107+13, (107-13)/2=47, 120-47=73. Set 2: {13, 47, 73, 107}.
%e 120=103+17, (103-17)/2=43, 120-43=77=7*11, X
%e 120=101+19, (101-19)/2=41, 120-41=79. Set 3: {19, 41, 79, 101}.
%e 120=97+23, (97-23)/2=37, 120-37=83. Set 4: {23, 37, 83, 97}.
%e 120=89+31, (89-31)/2=29, 120-29=91=7*13, X
%e 120=83+37, same with Set 4.
%e 120=79+41, same with Set 3.
%e 120=73+47, same with Set 2.
%e 120=67+53, same with Set 1.
%e 120=61+59, (61-59)/2=1, X
%e So four acceptable sets have been found, and therefore a(30)=4.
%p N:= 100: # for a(1)..a(N)
%p V:= Vector(N):
%p P:= select(isprime, [seq(i,i=3..2*N,2)]):
%p nP:= nops(P):
%p for i from 1 to nP do
%p p:= P[i];
%p for j from i+1 to nP do
%p q:= P[j];
%p if p+q > 2*N then break fi;
%p r:= (p+q)/2;
%p if isprime(p+2*q) and isprime(2*p+q) then
%p V[r]:= V[r]+1
%p fi
%p od
%p od:
%p convert(V,list); # _Robert Israel_, Jun 08 2022
%t 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
%o (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
%Y Cf. A002375, A354834.
%K nonn,easy
%O 1,12
%A _Lei Zhou_, Feb 14 2014
|