project-euler/106_special_subset_sums_met...

18 lines
282 B
Python

#!/usr/bin/env python3
from math import factorial
def bin(n, k):
if n < 0:
return 0
if n < k:
return 0
return factorial(n) // (factorial(n-k) * factorial(k))
n = 12
ms = 0
for k in range(0, n//2 +1):
ms += bin(n, 2*k) * bin(2*k-1, k+1)
print(ms)