OFFSET
1,3
COMMENTS
EXAMPLE
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.
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 *)
PROG
(PARI) is(k)=pr=prod(j=1, k, prime(j)); ispseudoprime(pr-1)||ispseudoprime(pr+1) \\ Jeppe Stig Nielsen, Aug 01 2019
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Ray Chandler, Sep 29 2003
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
STATUS
approved