login
Smallest prime p such that prime(n)#/2 + 2*p is prime where p > 3, except p=2 for n=1.
2

%I #16 Apr 12 2017 04:43:19

%S 2,5,7,11,13,19,29,31,29,31,41,41,43,83,59,83,163,97,193,89,89,173,

%T 113,107,131,157,131,109,113,467,151,239,167,263,233,211,251,167,599,

%U 199,199,211,313,241,509,887,307,227,419,479,317,269,653,281,307,277,499

%N Smallest prime p such that prime(n)#/2 + 2*p is prime where p > 3, except p=2 for n=1.

%H Vincenzo Librandi, <a href="/A098170/b098170.txt">Table of n, a(n) for n = 1..200</a>

%e For n=4, A002110(4)/2=210/2=105. 105+2*5 is not prime. 105+2*7 is not prime. 105+2*11 is prime, so a(4)=11.

%p A098170 := proc(n)

%p local pri,j,jmin;

%p pri := A002110(n)/2 ;

%p if n = 1 then

%p jmin := 1;

%p else

%p jmin := 3;

%p end if;

%p for j from jmin do

%p if isprime(pri+2*ithprime(j)) then

%p return ithprime(j) ;

%p end if;

%p end do:

%p end proc: # _R. J. Mathar_, Apr 12 2017

%t Primorial[n_Integer] := Block[{k = Product[ Prime[ j], {j, n}]}, k]; f[n_] := Block[{p = Primorial[n]/2}, If[n == 1, j = 1, j = 2]; While[ !PrimeQ[p + 2Prime[j]], j++ ]; Prime[j]]; Table[ f[n], {n, 57}] (* _Robert G. Wilson v_, Sep 04 2004 *)

%Y The indices of the p are in A098171.

%K nonn

%O 1,1

%A _Pierre CAMI_, Aug 30 2004

%E Edited and extended by _Robert G. Wilson v_, Sep 04 2004