login
This site is supported by donations 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

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

Cf. A083743, A083744.

Sequence in context: A239122 A195495 A003816 * A306072 A185199 A201196

Adjacent sequences:  A083742 A083743 A083744 * A083746 A083747 A083748

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 23 21:10 EDT 2019. Contains 325267 sequences. (Running on oeis4.)