Files
contests/053/main.py

40 lines
804 B
Python

'''
There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation,
.
In general,
, where , , and .
It is not until , that a value exceeds one-million:
.
How many, not necessarily distinct, values of
for , are greater than one-million?
'''
# Okay I have to admit that it looks really bad without the math equations
import time
import math
def main():
print("Hello, this is Patrick")
t0 = time.time()
tooBig = 1000000
counter = 0
for n in range(1, 101):
for r in range(1, n+1):
if math.comb(n, r) > tooBig:
counter += 1
print(counter, time.time() - t0)
if __name__ == "__main__":
main()