OFFSET
1,5
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
FORMULA
a(1) = 0; after which, a(2n) = 1 and a(2n+1) = A000720(2n+1)-1. - Antti Karttunen, Nov 17 2019
a(n) = Sum_{k=1..n} (-1)^(n-k)*pi(k), where pi = A000720. - Ridouane Oudra, May 27 2023
MAPLE
with(numtheory): a:=proc(n) if n=1 then 0 elif (n mod 2)= 0 then 1 else pi(n)-1; fi: end proc: seq(a(n), n=1..100); # Ridouane Oudra, May 27 2023
MATHEMATICA
f[x_] := PrimePi[x]-f[x-1] f[0]=0; Table[f[w], {w, 1, 128}]
nxt[{n_, a_}]:={n+1, PrimePi[n+1]-a}; NestList[nxt, {1, 0}, 100][[All, 2]] (* Harvey P. Dale, Jul 19 2021 *)
PROG
(PARI) k=pp=0; for(n=1, 99, pp+=isprime(n); k=pp-k; print1(k", ")) \\ Charles R Greathouse IV, May 15 2013
(PARI) A082460(n) = if(1==n, 0, if(!(n%2), 1, primepi(n)-1)); \\ Antti Karttunen, Nov 17 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Apr 26 2003
EXTENSIONS
Offset corrected to 1 and more terms from Antti Karttunen, Nov 17 2019
STATUS
approved