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”).

A246514
Number of composite numbers between prime(n) and 2*prime(n) exclusive.
17
0, 1, 3, 4, 7, 9, 12, 14, 17, 22, 23, 27, 31, 33, 37, 41, 45, 48, 53, 56, 59, 63, 67, 72, 77, 80, 83, 87, 90, 94, 103, 107, 111, 113, 121, 124, 128, 134, 138, 144, 148, 150, 158, 160, 164, 166, 175, 184, 188, 190, 193, 199, 201, 209, 214, 219, 226, 228, 234
OFFSET
1,3
LINKS
FORMULA
a(n) + A070046(n) = number of numbers between prime(n) and 2*prime(n), which is prime(n)-1. - N. J. A. Sloane, Aug 28 2014
EXAMPLE
2 P 4 = 0,
3 4 P 6 = 1,
5 6 P 8 9 10 = 3,
7 8 9 10 P 12 P 14 = 4,
11 12 P 14 15 16 P 18 P 20 21 22 = 7
and so on.
MAPLE
A246515 := proc(n) local p; p:=ithprime(n); n - 1 + p - numtheory:-pi(2*p - 1); end; # N. J. A. Sloane, Oct 20 2024
[seq(A246515(n), n=1..120)];
MATHEMATICA
Table[Prime[n] - PrimePi[2*Prime[n]] + n - 1, {n, 100}] (* Paolo Xausa, Oct 22 2024 *)
PROG
(PARI) s=[]; forprime(p=2, 1000, n=0; for(q=p+1, 2*p-1, if(!isprime(q), n++)); s=concat(s, n)); s \\ Colin Barker, Aug 28 2014
(PARI) a(n)=prime(n)+n-1-primepi(2*prime(n))
vector(100, n, a(n)) \\ Faster program. Jens Kruse Andersen, Aug 28 2014
(Python)
from sympy import prime, primepi
def A246514(n): return (m:=prime(n))+n-1-primepi(m<<1) # 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: A198772 A185256 A070992 * A060142 A049844 A369568
KEYWORD
nonn,easy
AUTHOR
Odimar Fabeny, Aug 28 2014
EXTENSIONS
More terms from Colin Barker, Aug 28 2014
STATUS
approved