%I #11 Dec 24 2014 09:51:06
%S 1,-1,-4,0,-5,1,8,16,25,35,46,58,45,31,46,62,45,63,82,102,123,145,168,
%T 192,217,243,270,298,327,357,388,420,453,419,454,490,527,565,604,644,
%U 685,643,686,730,775,729,776,824,873,923,974,1026,1079,1133,1188,1244,1187,1245,1304
%N a(1) = 1; if a(n-1) + n is composite or 1 then a(n) = a(n-1) + n, else a(n) = a(n-1) - n.
%H Harvey P. Dale, <a href="/A083745/b083745.txt">Table of n, a(n) for n = 1..1000</a>
%p 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
%t 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 *)
%Y Cf. A083743, A083744.
%K easy,sign
%O 1,3
%A _Amarnath Murthy_, May 05 2003
%E More terms from _James A. Sellers_, May 19 2003