A088411 A088257 indexed by A002110.
0, 1, 2, 3, 4, 5, 6, 11, 13, 24, 66, 68, 75, 167, 171, 172, 287, 310, 352, 384, 457, 564, 590, 616, 620, 643, 849, 1391, 1552, 1613, 1849, 2122, 2647, 2673, 4413, 13494, 31260, 33237, 67132, 85586, 234725
Offset: 1
Examples
3 is in the sequence because primorial p_3# = 2 * 3 * 5 = 30 has two prime neighbors 29 and 31. 4 is in the sequence because primorial p_4# = 2 * 3 * 5 * 7 = 210 has one prime neighbor 211; 209 = 11 * 19. 7 is not in the sequence because the product of the smallest 7 primes has two composite neighbors.
Programs
-
Maple
A:= NULL: P:= 1: p:= 1; for n from 1 to 700 do p:= nextprime(p); P:= P*p; if isprime(P+1) or isprime(P-1) then A:= A, n fi od: A; # Robert Israel, Aug 03 2016
-
Mathematica
Select[Range[0, 600], Total@ Boole@ PrimeQ@ {# - 1, # + 1} > 0 &@ Apply[Times, Prime@ Range@ #] &] (* Michael De Vlieger, Aug 03 2016 *)
-
PARI
is(k)=pr=prod(j=1,k,prime(j));ispseudoprime(pr-1)||ispseudoprime(pr+1) \\ Jeppe Stig Nielsen, Aug 01 2019
Extensions
a(22)-a(27) from Michael De Vlieger, Aug 03 2016
a(28)-a(40) from Jeppe Stig Nielsen, Aug 01 2019
a(41) from Jeppe Stig Nielsen, Oct 19 2021
Comments