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”).
%I #24 Sep 08 2022 08:46:20
%S 0,0,1,1,1,1,1,2,2,1,1,2,2,2,2,2,2,3,3,4,4,3,3,4,4,3,3,3,3,4,4,5,5,4,
%T 4,4,4,4,4,4,4,5,5,6,6,5,5,6,6,6,6,6,6,7,7,7,7,6,6,7,7,7,7,7,7,7,7,8,
%U 8,8,8,9,9,9,9,9,9,9,9,10,10,9,9,10,10,9
%N a(n) = pi(n-1) - pi(floor(n/2)), where pi is A000720.
%C Number of primes in the interval (n/2, n).
%C Number of primes among the larger parts of the partitions of n into two distinct parts. For n=8, the partitions of 8 into two distinct parts are (7,1), (6,2), (5,3); 7 and 5 are prime so a(8) = 2. - _Wesley Ivan Hurt_, Apr 07 2018
%F a(n) = A056171(n) - A010051(n).
%F a(n) = Sum_{i=1..floor((n-1)/2)} A010051(n-i). - _Wesley Ivan Hurt_, Apr 07 2018
%e a(8) = 2 because there are 2 primes between 4 and 8: 5, 7.
%e a(19) = 3 because there are 3 primes between 9 and 19: 11, 13, 17.
%p A294602 := proc(n)
%p numtheory[pi](n-1)-numtheory[pi](floor(n/2)) ;
%p end proc:
%p seq(A294602(n),n=1..120) ; # _R. J. Mathar_, Dec 17 2017
%t Array[PrimePi[# - 1] - PrimePi[Floor[#/2]] &, 86] (* _Michael De Vlieger_, Nov 03 2017 *)
%o (Magma) [0, 0] cat [#PrimesInInterval(Floor(n/2)+1, n-1): n in [3..86]];
%o (PARI) vector(86, n, primepi(n-1)-primepi(n\2))
%Y Cf. A000720, A001221, A010051, A056171.
%K nonn,easy
%O 1,8
%A _Arkadiusz Wesolowski_, Nov 03 2017