login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A083745 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. 1
1, -1, -4, 0, -5, 1, 8, 16, 25, 35, 46, 58, 45, 31, 46, 62, 45, 63, 82, 102, 123, 145, 168, 192, 217, 243, 270, 298, 327, 357, 388, 420, 453, 419, 454, 490, 527, 565, 604, 644, 685, 643, 686, 730, 775, 729, 776, 824, 873, 923, 974, 1026, 1079, 1133, 1188, 1244, 1187, 1245, 1304 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
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
Sequence in context: A309214 A309215 A309216 * A327545 A306072 A185199
KEYWORD
easy,sign
AUTHOR
Amarnath Murthy, May 05 2003
EXTENSIONS
More terms from James A. Sellers, May 19 2003
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 12:54 EDT 2024. Contains 371943 sequences. (Running on oeis4.)