OFFSET
0,2
COMMENTS
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = a(n-1) + a prime for n odd >4.
a(n) = -a(n-1) for a(n-1)>0, n>1.
EXAMPLE
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.
MATHEMATICA
Module[{n = 0}, DeleteDuplicates[NestList[If[PrimeQ[++n], # + Prime[n], -#] &, 0, 200]]] (* Paolo Xausa, Dec 06 2024 *)
CROSSREFS
KEYWORD
sign,new
AUTHOR
Bill McEachen, Dec 03 2024
STATUS
approved