login
A376760
Let c(n) = A002808(n) denote the n-th composite number; a(n) = number of composite numbers c with c(n) <= c <= 2*c(n).
17
3, 5, 7, 7, 7, 9, 12, 12, 12, 15, 17, 17, 17, 19, 20, 21, 21, 22, 24, 26, 27, 27, 28, 28, 30, 31, 31, 33, 36, 36, 37, 40, 40, 41, 41, 41, 43, 43, 44, 44, 45, 48, 51, 52, 52, 53, 53, 56, 56, 56, 59, 62, 62, 62, 63, 64, 66, 67, 67, 69, 70, 71, 71, 72, 74, 74, 75, 76, 77, 78, 78, 80, 80, 80, 83, 86, 87, 87, 90, 93, 94, 94, 96, 96, 97, 97, 98, 99, 99, 99, 100, 101, 102, 103
OFFSET
1,1
COMMENTS
There are three other versions: composite c with c(n) < c < 2*c(n): a(n)-2; c(n) <= c < 2*c(n): a(n) - 1; and c(n) < c <= 2*c(n): also a(n) - 1.
LINKS
FORMULA
a(n) = 2*A002808(n) - A000720(2*A002808(n)) - n. - Paolo Xausa, Oct 22 2024
EXAMPLE
The 5th composite number is 10, and 10, 12, 14, 15, 16, 18, 20 are composite, so a(5) = 7.
MAPLE
chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855
t := []: for n from 2 to 200000 do if not isprime(n) then t := [op(t), n]; fi; od: # precompute A002808
ithchi := proc(n) t[n]; end: # returns n-th composite number A002808 for any n <= 182015, analogous to ithprime
A376760 := proc(n) chi(2*ithchi(n)) - n + 1; end;
[seq(A376760(n), n=1..120)];
MATHEMATICA
MapIndexed[2*# - PrimePi[2*#] - #2[[1]] &, Select[Range[100], CompositeQ]] (* Paolo Xausa, Oct 22 2024 *)
PROG
(Python)
from sympy import composite, primepi
def A376760(n): return (m:=composite(n)<<1)-primepi(m)-n # Chai Wah Wu, Oct 22 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: A342622 A211517 A254935 * A104199 A103470 A316852
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 22 2024
STATUS
approved