OFFSET
1,1
EXAMPLE
a(7) = 29 = 4*7 + 1 = 7!!! + 1 is the 7th prime of that form.
a(8) = 79 = 2*5*8 - 1 = 8!!! - 1 is the 8th prime of that form.
MATHEMATICA
Select[Union@ Flatten@ Map[{# - 1, # + 1} &, Table[With[{q = Quotient[n + 2, 3]}, 3^q q! Binomial[n/3, q]], {n, 0, 58}]], PrimeQ] (* Michael De Vlieger, Jun 21 2016, after Jan Mangaldan at A007661 *)
Select[Union[Flatten[#+{1, -1}&/@Table[Times@@Range[n, 1, -3], {n, 100}]]], PrimeQ] (* Harvey P. Dale, Sep 05 2022 *)
PROG
(Magma) r:=59; I:=[1, 1, 2]; lst1:=[n le 3 select I[n] else (n-1)*Self(n-3): n in [1..r]]; lst2:=[]; for c in [1..r] do a:=lst1[c]; for s in [-1..1 by 2] do p:=a+s; if IsPrime(p) and not p in lst2 then Append(~lst2, p); end if; end for; end for; lst2;
CROSSREFS
KEYWORD
nonn
AUTHOR
Arkadiusz Wesolowski, Jun 19 2016
STATUS
approved