This site is supported by donations to The OEIS Foundation.

 Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing. Other ways to donate

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A008348 a(0)=0; thereafter a(n) = a(n-1) + prime(n) if a(n-1) < prime(n), otherwise a(n) = a(n-1) - prime(n). 15
 0, 2, 5, 0, 7, 18, 5, 22, 3, 26, 55, 24, 61, 20, 63, 16, 69, 10, 71, 4, 75, 2, 81, 164, 75, 172, 71, 174, 67, 176, 63, 190, 59, 196, 57, 206, 55, 212, 49, 216, 43, 222, 41, 232, 39, 236, 37, 248, 25, 252, 23, 256, 17, 258, 7, 264, 1, 270, 541, 264, 545, 262, 555 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,2 COMMENTS a(n) < 2*prime(n). Conjecture: a(n) > 0 for n > 3. - Thomas Ordowski, Dec 03 2016. This conjecture is false, because a(369019)=0. The next counter-example occurs at n = 22877145. - Dmitry Kamenetsky, Feb 14 2017. (Cf. A309225.) LINKS Robert Israel, Table of n, a(n) for n = 0..10000 FORMULA a(n) = c(1)p(1) + ... + c(n)p(n), where c(i) = 1 if a(i-1) > p(i) and c(i) = -1 if a(i-1) <= p(i) (p(i) = primes). - Clark Kimberling MAPLE A008348 := proc(n) option remember; if n = 0 then 0 elif A008348(n-1)>=ithprime(n) then A008348(n-1)-ithprime(n); else A008348(n-1)+ithprime(n); fi; end; # Maple from N. J. A. Sloane, Aug 31 2019 (Start) # Riecaman transform Riecaman := proc(a, s, M) # Start with s, add or subtract a[n], get M terms. If a has w terms, can get M=w+1 terms. local b, M2, n, t; if whattype(a) <> list then ERROR("First argument should be a list"); fi; if a[1]=0 then ERROR("a[1] should not be zero"); fi; M2 := min(nops(a), M-1); b:=[s]; t:=s; for n from 1 to M2 do    if a[n]>t then t:=t+a[n] else t:=t-a[n]; fi; b:=[op(b), t]; od: b; end; # Riecaman transform of primes, starting at s=0 p1:=[seq(ithprime(i), i=1..100)]; q0:=Riecaman(p1, 0, 99); # End MATHEMATICA a := {0}; For[n = 2, n < 100, n++, If[a[[n - 1]] >= Prime[n - 1], b := a[[n - 1]] - Prime[n - 1], b := a[[n - 1]] + Prime[n - 1]; ]; a = Append[a, b]]; a (* Stefan Steinerberger, May 02 2006 *) PROG (PARI) lista(nn) = {print1(a=0, ", "); for (n=1, nn, if (a < (p=prime(n)), a += p, a -= p); print1(a, ", "); ); } \\ Michel Marcus, Dec 04 2016 CROSSREFS Cf. A008344, A022831, A022837, A309225. Sequence in context: A096319 A146105 A022832 * A201576 A265299 A020836 Adjacent sequences:  A008345 A008346 A008347 * A008349 A008350 A008351 KEYWORD nonn,look AUTHOR EXTENSIONS More terms from Clark Kimberling Name edited by Dmitry Kamenetsky, Feb 14 2017 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.

Last modified December 7 22:29 EST 2019. Contains 329850 sequences. (Running on oeis4.)