# Binary partition function

Hello, I am trying to figure out how to return the number of partitions of n as powers of 2 (sometimes called the binary partition function $b(n)$). For example, $4 = 2^2 = 2^1+2^0+2^0 = 2^0+2^0+2^0+2^0$, then $b(4)=3$.

I just can't get anything to work. I would really appreciate some help. Thank you so much! This community is always so helpful!

If the code can be written so that it gives the number of partitions of $n$ as powers of $k$ that would be unbelievably helpful.