OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(7) = 17. So a(8) = the largest prime <= 17 + 7 = 24, which is 23.
MATHEMATICA
PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; a[1] = 1; a[n_] := a[n] = PrevPrim[a[n - 1] + n]; Array[a, 55] (* Robert G. Wilson v *)
a[1]=1; a[n_]:=NextPrime[a[n-1]+n, -1]; Table[a[n], {n, 55}] (* James C. McMahon, Jun 16 2024 *)
nxt[{n_, a_}]:={n+1, If[PrimeQ[a+n], a+n, NextPrime[a+n, -1]]}; NestList[nxt, {1, 1}, 60][[;; , 2]] (* Harvey P. Dale, Dec 15 2024 *)
PROG
(PARI) {print1(a=1, ", "); for(n=2, 55, print1(a=precprime(a+n-1), ", "))} \\ Klaus Brockhaus, Jan 06 2006
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Jan 05 2006
EXTENSIONS
More terms from Klaus Brockhaus and Robert G. Wilson v, Jan 06 2006
STATUS
approved