A307912 a(n) = n - 1 - pi(2*n-1) + pi(n), where pi is the prime counting function.
0, 0, 1, 1, 3, 3, 4, 5, 5, 5, 7, 7, 9, 10, 10, 10, 12, 13, 14, 15, 15, 15, 17, 17, 18, 19, 19, 20, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, 29, 29, 31, 31, 33, 34, 34, 35, 37, 38, 38, 39, 39, 39, 41, 41, 41, 42, 42, 43, 45, 46, 48, 49, 50, 50, 51, 51, 53, 54
Offset: 1
Examples
a(7) = 4; there are 4 composites in the closed interval [8, 13]: 8, 9, 10 and 12.
Links
Crossrefs
Programs
-
Maple
chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855 A307912 := proc(n) chi(2*n-1) - chi(n); end; A := [seq(A307912(n),n=1..120)]; # N. J. A. Sloane, Oct 20 2024
-
Mathematica
Table[n - 1 - PrimePi[2 n - 1] + PrimePi[n], {n, 100}]
-
Python
from sympy import primepi def A307912(n): return n+primepi(n)-primepi((n<<1)-1)-1 # Chai Wah Wu, Oct 20 2024
Comments