Create a gist now

Instantly share code, notes, and snippets.

import itertools as it
from collections import Counter
l = [1,14,14,4,11,7,6,9,8,10,10,5,13,2,3,15]
ans = []
for i in range(len(l)):
for d in it.combinations(l,i):
ans.append(sum(d))
counter = Counter(ans)
for num, cnt in counter.most_common():
print(num, cnt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment