%I #10 Aug 15 2023 07:45:05
%S 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,
%T 14,15,16,17,18,19,19,19,19,19,20,21,21,21,21,21,22,23,24,25,26,27,27,
%U 27,27,27,27,27,28,29,29,29,29,29,29,29,30,31,32,33,33,33,34,35,36,37,38
%N Partial sums of A131378.
%p 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);
%t 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 *)
%o (PARI) a(n) = sum(m=0, n, (primepi(m) % 2) == 1); \\ _Michel Marcus_, Aug 15 2023
%Y Cf. A131378.
%K easy,nonn
%O 0,6
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 18 2007