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!)
A022836 a(n) = c(1)*p(0) + ... + c(n)*p(n-1), where c(i) = 1 if a(i-1) <= p(i-1) and c(i) = -1 if a(i-1) > p(i-1) (with p(0) = 1 and p(i) a prime for i >= 1). 1
1, 3, 6, 1, 8, 19, 6, 23, 4, 27, 56, 25, 62, 21, 64, 17, 70, 11, 72, 5, 76, 3, 82, 165, 76, 173, 72, 175, 68, 177, 64, 191, 60, 197, 58, 207, 56, 213, 50, 217, 44, 223, 42, 233, 40, 237, 38, 249, 26, 253, 24, 257, 18, 259, 8, 265, 2, 271, 542, 265, 546, 263, 556 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
Alternate description: a(1) = 1, a(n) = a(n-1) - prime(n) if a(n-1) > prime(n) else a(n) = a(n-1) + prime(n). - Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jun 27 2003
LINKS
FORMULA
a(n) = A008348(n) + 1.
MATHEMATICA
nxt[{n_, a_}]:=Module[{p=Prime[n]}, {n+1, If[a>p, a-p, a+p]}]; NestList[ nxt, {1, 1}, 70][[All, 2]] (* Harvey P. Dale, Nov 27 2016 *)
CROSSREFS
Sequence in context: A118948 A176092 A118012 * A090911 A198491 A336245
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name corrected by Sean A. Irvine, May 22 2019
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 July 17 05:50 EDT 2024. Contains 374360 sequences. (Running on oeis4.)