euler/python/e053.py

20 lines
409 B
Python

import math
def combinations_naiv(n, r):
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
def euler_053():
count = 0
for n in range(1, 101):
for r in range(1, n + 1):
if combinations_naiv(n, r) > 10**6:
count += 1
return count
if __name__ == "__main__":
print("e053.py: " + str(euler_053()))
assert(euler_053() == 4075)