login
A131808
Partial sums of A131378.
0
0, 0, 1, 1, 1, 2, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 6, 7, 7, 7, 7, 7, 8, 9, 10, 11, 12, 13, 13, 13, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 20, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 27, 27, 27, 27, 27, 27, 28, 29, 29, 29, 29, 29, 29, 29, 30, 31, 32, 33, 33, 33, 34, 35, 36, 37, 38
OFFSET
0,6
MAPLE
P:=proc(n) local i, k, s; k:=0; s:=0; for i from 0 by 1 to n do if isprime(i) then if k=1 then k:=0; else k:=1; fi; fi; s:=s+k; print(s); od; end: P(100);
MATHEMATICA
nxt[{n_, a_}]:={n+1, Which[a==0&&PrimeQ[n+1], 1, a==1&&PrimeQ[n+1], 0, True, a]}; Accumulate[NestList[nxt, {0, 0}, 100][[All, 2]]] (* Harvey P. Dale, Jul 19 2019 *)
PROG
(PARI) a(n) = sum(m=0, n, (primepi(m) % 2) == 1); \\ Michel Marcus, Aug 15 2023
CROSSREFS
Cf. A131378.
Sequence in context: A189635 A109785 A058224 * A196183 A200264 A104406
KEYWORD
easy,nonn
AUTHOR
STATUS
approved