OFFSET
0,2
LINKS
EXAMPLE
n=5: in the sequence 1+k*5: 6,11,16,21,26,31,36,41,... the first prime >13=a(4) is 31, therefore a(5)=31.
MATHEMATICA
a[0] = 1; a[1] = 2; a[n_] := a[n] = (p = NextPrime[a[n-1]]; While[True, If[Mod[p, n] == 1, Break[], p = NextPrime[p]]]; p); Table[a[n], {n, 0, 45}] (* Jean-François Alcover, Oct 10 2011 *)
lp[{n_, p_}]:=Module[{np=NextPrime[p]}, While[!IntegerQ[(np-1)/(n+1)], np= NextPrime[np]]; {n+1, np}]; Transpose[NestList[lp, {0, 1}, 50]][[2]] (* Harvey P. Dale, May 12 2015 *)
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Reinhard Zumkeller, Jun 12 2002
STATUS
approved