



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,6


LINKS

Table of n, a(n) for n=0..77.


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 *)


CROSSREFS

Cf. A131378.
Sequence in context: A189635 A109785 A058224 * A196183 A200264 A104406
Adjacent sequences: A131805 A131806 A131807 * A131809 A131810 A131811


KEYWORD

easy,nonn


AUTHOR

Paolo P. Lava and Giorgio Balzarotti, Jul 18 2007


STATUS

approved



