A307989 a(n) = n - pi(2*n) + pi(n-1), where pi is the prime counting function.
0, 0, 1, 2, 3, 4, 4, 6, 6, 6, 7, 8, 9, 11, 11, 11, 12, 14, 14, 16, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 25, 26, 26, 27, 27, 27, 29, 30, 30, 31, 32, 33, 35, 35, 36, 37, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 45, 47, 48, 50, 51, 51, 52, 52, 53, 55
Offset: 1
Examples
a(7) = 4; There are 7 partitions of 2*7 = 14 into two parts (13,1), (12,2), (11,3), (10,4), (9,5), (8,6), (7,7). Among the largest parts 12, 10, 9 and 8 are composite, so a(7) = 4.
Links
Crossrefs
Programs
-
Maple
chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855 A307989 := proc(n) chi(2*n-1) - chi(n-1); end; a := [seq(A307989(n),n=1..120)];
-
Mathematica
Table[n - PrimePi[2 n] + PrimePi[n - 1], {n, 100}]
-
Python
from sympy import primepi def A307989(n): return n+primepi(n-1)-primepi(n<<1) # Chai Wah Wu, Oct 20 2024
Comments