login
Smallest prime representable in exactly n ways as p + 2*q, p and q primes.
2

%I #12 Jun 08 2020 02:44:03

%S 7,11,23,17,41,97,89,113,163,197,257,233,373,317,389,491,613,557,641,

%T 773,761,953,977,929,1097,1049,1109,1217,1433,1327,1493,1613,1553,

%U 1871,1759,1877,1747,2003,2357,2287,2237,2213

%N Smallest prime representable in exactly n ways as p + 2*q, p and q primes.

%C The sequence is non-monotone and infinite.

%H Robert Israel, <a href="/A284052/b284052.txt">Table of n, a(n) for n = 1..2000</a>

%e 7 = 3 + 2*2,

%e 11 = 7 + 2*2 = 5 + 2*3,

%e 23 = 13 + 2*5 = 17 + 2*3 = 19 + 2*2,

%e 17 = 3 + 2*7 = 7 + 2*5 = 11 + 2*3 = 13 + 2*2.

%p N:= 10000: # for all terms before the first term > N

%p V:= Vector(N):

%p Primes:= select(isprime, [2,seq(i,i=3..N,2)]):

%p for ip from 1 to nops(Primes) do

%p p:= Primes[ip];

%p for iq from 1 do

%p r:= p+2*Primes[iq];

%p if r > N then break fi;

%p V[r]:= V[r]+1;

%p od od:

%p Nmax:= max(V):

%p A:= Vector(Nmax):

%p for p in Primes do

%p m:= V[p];

%p if m > 0 and A[m] = 0 then A[m]:= p fi;

%p od:

%p m:= min(select(t -> A[t]=0, [$1..Nmax])):

%p seq(A[i],i=1..m-1); # _Robert Israel_, Jun 07 2020

%t np[n_] := np[n] = Length@ Select[n - 2*Prime@ Range@ PrimePi[n/2], PrimeQ]; a[n_] := Block[{p=2}, While[np[p] != n, p = NextPrime@ p]; p]; Array[a, 100] (* _Giovanni Resta_, Mar 19 2017 *)

%K nonn

%O 1,1

%A _Zak Seidov_, Mar 19 2017