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
KEYWORD
easy,nonn
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jul 18 2007
STATUS
approved