euler/python/e053.py

20 lines
409 B
Python
Raw Normal View History

2019-07-18 03:29:59 +02:00
import math
def combinations_naiv(n, r):
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
def euler_053():
2019-07-18 03:29:59 +02:00
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()))
2019-07-18 03:29:59 +02:00
assert(euler_053() == 4075)