Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Dec 06 2024 16:30:20
%S 0,3,8,-8,-3,14,-14,17,-17,24,-24,35,-35,32,-32,51,-51,58,-58,69,-69,
%T 88,-88,91,-91,100,-100,111,-111,130,-130,147,-147,136,-136,195,-195,
%U 158,-158,209,-209,192,-192,239,-239,222,-222,287,-287,260,-260,303,-303
%N a(n)=a(n-1) + prime(n) for n prime, and a(n)=-a(n-1) otherwise, with a(0)=0, with duplicates removed afterwards.
%C Let b = subset of positive terms for n>4. We have A073131= b(m+2)-b(m) , A006450= b(m+2)+b(m) and A299644= b(m+2)+2*b(m+1)+b(m).
%H Paolo Xausa, <a href="/A378677/b378677.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = a(n-1) + a prime for n odd >4.
%F a(n) = -a(n-1) for a(n-1)>0, n>1.
%e n=1 is not prime, so a(1)= -a(0)= 0. n=2 is prime, so a(2)=a(1)+prime(2)=0+3=3. n=5 is prime, so a(5)=3, but note that it duplicates a(2). n=6 is not prime, so a(6)= -a(5)=-3. After terms are computed, duplicates are only then removed, which will alter indices accordingly.
%t Module[{n = 0}, DeleteDuplicates[NestList[If[PrimeQ[++n], # + Prime[n], -#] &, 0, 200]]] (* _Paolo Xausa_, Dec 06 2024 *)
%Y Cf. A006450, A073131, A299644.
%K sign,new
%O 0,2
%A _Bill McEachen_, Dec 03 2024