OFFSET
1,1
MATHEMATICA
a[1] = 2; a[n_] := a[n] = Module[{r = Product[a[k], {k, 1, n - 1}], p = 2}, While[! PrimeQ[r*p - 1] && ! PrimeQ[r*p + 1], p = NextPrime[p]]; p]; Array[a, 100] (* Amiram Eldar, Jul 08 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Dmitry Kamenetsky, Jul 08 2023
STATUS
approved