login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A082460
a(n) = pi(n) - a(n - 1) where pi(n) = A000720(n).
2
0, 1, 1, 1, 2, 1, 3, 1, 3, 1, 4, 1, 5, 1, 5, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1
OFFSET
1,5
LINKS
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
Cf. A000720.
Sequence in context: A327513 A327530 A084360 * A318573 A344774 A029227
KEYWORD
nonn
AUTHOR
Labos Elemer, Apr 26 2003
EXTENSIONS
Offset corrected to 1 and more terms from Antti Karttunen, Nov 17 2019
STATUS
approved