Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This should do the job:

def b(n):
    return Partitions(n,parts_in=[2**k for k in range(n.ndigits(2))]).cardinality()

Btw, you missed $4 = 2^1 + 2^1$ and so we should have $b(4)=4$.

This should do the job:job for given n and k:

def b(n):
b(n, k=2):
    return Partitions(n,parts_in=[2**k Partitions(n,parts_in=[k**i for k i in range(n.ndigits(2))]).cardinality()
range(n.ndigits(k))]).cardinality()

Btw, you missed $4 = 2^1 + 2^1$ and so we should have $b(4)=4$.