| 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$.
| 2 | No.2 Revision |
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$.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.