OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
MAPLE
a := proc(n) option remember: if n=1 then RETURN(1) fi: if isprime(a(n-1)+n) then RETURN(a(n-1)-n) else RETURN(a(n-1)+n) fi: end: for n from 1 to 100 do printf(`%d, `, a(n)) od: # James A. Sellers, May 19 2003
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[PrimeQ[a+n+1], a-n-1, a+n+1]}; Transpose[ NestList[ nxt, {1, 1}, 60]][[2]] (* Harvey P. Dale, Jun 06 2013 *)
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Amarnath Murthy, May 05 2003
EXTENSIONS
More terms from James A. Sellers, May 19 2003
STATUS
approved