login
Numbers k such that 1 plus twice the product of the first k primes is also a prime.
0

%I #29 May 30 2023 08:27:00

%S 1,2,3,4,5,11,18,23,26,30,80,120,148,220,395,776,884,977,3535,3927

%N Numbers k such that 1 plus twice the product of the first k primes is also a prime.

%e 5 is in the sequence because 2*(2*3*5*7*11) + 1 = 4621 is prime.

%t Position[2#+1&/@FoldList[Times,Prime[Range[800]]],_?PrimeQ]//Flatten (* _Harvey P. Dale_, Oct 09 2018 *)

%o (PARI) isok(k) = isprime(1+2*prod(j=1, k, prime(j))); \\ _Michel Marcus_, May 28 2018

%o (Python)

%o from sympy import isprime, nextprime

%o def afind(limit):

%o p, primorialk = 2, 2

%o for k in range(1, limit+1):

%o if isprime(2*primorialk + 1):

%o print(k, end=", ")

%o p = nextprime(p)

%o primorialk *= p

%o afind(400) # _Michael S. Branicky_, Dec 24 2021

%Y 2*A002110(n)+1 is prime. Cf. A051887, A051915.

%K nonn,more

%O 1,2

%A _Labos Elemer_, Dec 20 1999

%E More terms from _Harvey P. Dale_, Oct 09 2018

%E a(17)-a(18) from _Michael S. Branicky_, Dec 24 2021

%E a(19)-a(20) from _Michael S. Branicky_, May 30 2023