login
A307912
a(n) = n - 1 - pi(2*n-1) + pi(n), where pi is the prime counting function.
17
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,5
COMMENTS
For n > 1, a(n) is the number of composites in the closed interval [n+1, 2n-1].
a(n) is also the number of composites appearing among the largest parts of the partitions of 2n into two distinct parts.
FORMULA
a(n) = n - 1 - A060715(n).
a(n) = n - 1 - A000720(2*n-1) + A000720(n).
EXAMPLE
a(7) = 4; there are 4 composites in the closed interval [8, 13]: 8, 9, 10 and 12.
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}]
PROG
(Python)
from sympy import primepi
def A307912(n): return n+primepi(n)-primepi((n<<1)-1)-1 # Chai Wah Wu, Oct 20 2024
CROSSREFS
Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.
Sequence in context: A072648 A185585 A072945 * A274004 A196592 A120180
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, May 09 2019
STATUS
approved