Let $p(n)$ be A000041 i.e. number of partitions of $n$ (the partition numbers).
Let $$ \ell(n)=\left\lfloor\log_2 n\right\rfloor $$
Let $a(n)$ be A161511 i.e. number of $1\cdots0$ pairs in the binary representation of $2n$.
The sequence begins with $$ 0, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 7, 6 $$
Let $$ b(n) = a(n) + \ell(n) + 2, \\ b(0) = 0 $$
Let $$ f(n) = 2^{\left\lfloor\frac{n}{2}\right\rfloor - 1} - 1, \\ f(1) = f(2) = f(3) = 1 $$
Let $$ s(n) = \sum\limits_{i=0}^{f(n)}[b(i)<n](n-b(i)) $$
I conjecture that $$s(n) = p(n).$$
Here is the PARI/GP program to check it numerically:
b1(n) = my(b=binary(n)); b*-[-#b..-1]~;
a(n) = if(n == 0, 0, b1(n) - binomial(hammingweight(n), 2))
b(n) = if(n == 0, 0, a(n) + logint(n, 2) + 2)
f(n) = if(n \ 2 < 2, 1, 2 ^ (n \ 2 - 1) - 1)
s(n) = sum(i = 0, f(n), my(A = b(i)); if(A >= n, 0, n - A))
test(n) = s(n) == numbpart(n)
Is there a way to prove it?