OFFSET
1,1
COMMENTS
Except for the first term, same as A084401. - David Wasserman, Dec 22 2004
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000 (terms 1..300 from T. D. Noe)
FORMULA
Conjecture: a(n) = O(n). - Thomas Ordowski, Aug 08 2017
MAPLE
n := 1: while true do j := 2: while not isprime(j*n+1) do j := j+1: od: print(j): n := n*j: od:
MATHEMATICA
a[1] = 2; a[n_] := a[n] = Catch[For[an = 2, True, an++, If[PrimeQ[Product[a[k], {k, 1, n - 1}]*an + 1], Throw[an]]]]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Nov 27 2012 *)
nxt[{t_, n_}]:=Module[{k=2}, While[!PrimeQ[t*k+1], k++]; {t*k, k}]; NestList[ nxt, {2, 2}, 80][[All, 2]] (* Harvey P. Dale, Oct 03 2020 *)
PROG
(Python)
from gmpy2 import is_prime
from itertools import count, islice
def agen(): # generator of terms
p = 1
while True:
an = next(k for k in count(2) if (t:=p*k+1) == 1 or is_prime(t))
p *= an
yield an
print(list(islice(agen(), 81))) # Michael S. Branicky, Jan 20 2024
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Erich Friedman
More terms from Jud McCranie, Jan 26 2000
Description corrected by Len Smiley
STATUS
approved