login
Smallest prime p such that both 2*prime(n+1)+p and p*prime(n+1)+2 are primes.
1

%I #67 Jul 17 2020 22:54:44

%S 5,3,3,7,3,3,3,7,3,5,23,67,3,7,7,13,5,5,7,5,5,67,3,3,37,17,43,5,13,3,

%T 7,127,3,19,5,17,53,3,3,43,5,19,23,3,3,101,17,3,41,37,13,17,7,7,37,3,

%U 59,23,31,257,7,47,31,5,7,11,3,67,3,3,43,23

%N Smallest prime p such that both 2*prime(n+1)+p and p*prime(n+1)+2 are primes.

%C a(n)=3 if and only if prime(n+1) is in A106067. - _Robert Israel_, Jul 17 2020

%H Robert Israel, <a href="/A329973/b329973.txt">Table of n, a(n) for n = 1..10000</a>

%p f:= proc(n) local pn,p;

%p pn:= ithprime(n+1);

%p p:= 1;

%p do

%p p:= nextprime(p);

%p if isprime(2*pn+p) and isprime(p*pn+2) then return p fi

%p od

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Jul 17 2020

%t f[n_Integer/;n>1]:=Module[{p=3},While[Or[CompositeQ[2*Prime[n]+p],CompositeQ[p*Prime[n]+2]],p=NextPrime[p]];p];f/@Range[2,100]

%o (PARI) a(n) = my(p=2,q=prime(n+1)); while(!isprime(2*q+p) || !isprime(p*q+2), p=nextprime(p+1)); p; \\ _Michel Marcus_, Jun 08 2020

%Y Cf. A000040, A065091, A073703, A106067.

%K nonn

%O 1,1

%A _Ivan N. Ianakiev_, Jun 08 2020