I hereby claim:
- I am skovorodkin on github.
- I am skovorodkin (https://keybase.io/skovorodkin) on keybase.
- I have a public key ASDS0gCBgFjeLR6sekabR54T_HgG6_dNRuxFxgg4Uhl1Xwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# https://stackoverflow.com/questions/10035752/elegant-python-code-for-integer-partitioning/44209393?#comment78597595_44209393 | |
from itertools import chain, permutations | |
def partitions(n, I=1): | |
yield (n,) | |
for i in range(I, n//2 + 1): | |
for p in partitions(n-i, i): | |
yield (i,) + p |