%I #33 Oct 22 2024 13:00:14
%S 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,
%T 31,31,33,36,36,37,40,40,41,41,41,43,43,44,44,45,48,51,52,52,53,53,56,
%U 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
%N 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).
%C 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.
%H N. J. A. Sloane, <a href="/A376760/b376760.txt">Table of n, a(n) for n = 1..20000</a>
%F a(n) = 2*A002808(n) - A000720(2*A002808(n)) - n. - _Paolo Xausa_, Oct 22 2024
%e The 5th composite number is 10, and 10, 12, 14, 15, 16, 18, 20 are composite, so a(5) = 7.
%p chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855
%p t := []: for n from 2 to 200000 do if not isprime(n) then t := [op(t), n]; fi; od: # precompute A002808
%p ithchi := proc(n) t[n]; end: # returns n-th composite number A002808 for any n <= 182015, analogous to ithprime
%p A376760 := proc(n) chi(2*ithchi(n)) - n + 1; end;
%p [seq(A376760(n),n=1..120)];
%t MapIndexed[2*# - PrimePi[2*#] - #2[[1]] &, Select[Range[100], CompositeQ]] (* _Paolo Xausa_, Oct 22 2024 *)
%o (Python)
%o from sympy import composite, primepi
%o def A376760(n): return (m:=composite(n)<<1)-primepi(m)-n # _Chai Wah Wu_, Oct 22 2024
%Y Related sequences:
%Y Primes (p) and composites (c): A000040, A002808, A000720, A065855.
%Y 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.
%Y 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.
%K nonn,new
%O 1,1
%A _N. J. A. Sloane_, Oct 22 2024