A294023 Sum of the differences of the larger and smaller parts in the partitions of n into two parts with the smaller part prime.
0, 0, 0, 0, 1, 2, 4, 6, 8, 10, 13, 16, 19, 22, 26, 30, 34, 38, 42, 46, 50, 54, 59, 64, 69, 74, 80, 86, 92, 98, 104, 110, 116, 122, 129, 136, 143, 150, 158, 166, 174, 182, 190, 198, 206, 214, 223, 232, 241, 250, 259, 268, 277, 286, 295, 304, 313, 322, 332
Offset: 1
Examples
The partitions of n = 11 into a number and a smaller prime number are 9 + 2, 8 + 3, and 6 + 5, so a(11) = (9 - 2) + (8 - 3) + (6 - 5) = 13. - _Michael B. Porter_, Apr 06 2018
Programs
-
Maple
with(numtheory): seq(add(pi(floor(i/2)), i=1..n-1), n=1..100); # Ridouane Oudra, Nov 24 2019
-
Mathematica
Table[Sum[(n - 2 i) (PrimePi[i] - PrimePi[i - 1]), {i, Floor[n/2]}], {n, 60}]
-
PARI
a(n) = sum(i=1, n\2, (n - 2*i)*isprime(i)); \\ Michel Marcus, Mar 24 2018
-
PARI
a(n) = my(res = 0); forprime(p = 2, n >> 1, res += (n - p << 1)); res \\ David A. Corneth, Apr 06 2018
Formula
a(n) = Sum_{i=1..floor(n/2)} (n - 2i)*A010051(i).
First differences are A056172. - David A. Corneth, Apr 06 2018
a(n) = Sum_{i=1..n-1} pi(floor(i/2)), where pi(n) = A000720(n). - Ridouane Oudra, Nov 24 2019
Comments