%I #19 Oct 09 2020 09:03:41
%S 0,1,2,2,2,3,3,4,4,4,4,3,4,5,6,5,4,6,6,6,8,7,8,8,6,6,8,9,11,12,8,9,8,
%T 9,8,10,9,10,11,12,11,12,11,12,13,14,12,10,11,12,12,13,14,13,13,13,15,
%U 16,17,18,19,18,14,14,16,17,13,14,13,15,16,17,16,16
%N The difference between the number of prime numbers in the ranges (1, p_n] and (p_n, 2*p_n], where p_n is the n-th prime.
%F a(n) = 2*n - pi(2*p_n).
%F a(n) = 2*n - A020900(n). - _Michel Marcus_, Sep 11 2020
%F a(n) = 1 + A331677(n). - _Alois P. Heinz_, Oct 09 2020
%e a(6) = 2*6 - pi(2*p_6) = 12 - pi(2*13) = 12 - pi(26) = 12 - 9 = 3.
%o (Python)
%o from sympy import prime, primepi
%o for n in range(1, 10001):
%o a = 2*n - primepi(2*prime(n))
%o print(a)
%o (PARI) a(n) = 2*n - primepi(2*prime(n)); \\ _Michel Marcus_, Sep 11 2020
%Y Cf. A000040, A000720, A020900, A331677.
%K nonn
%O 1,3
%A _Ya-Ping Lu_, Sep 11 2020
|