Rebased projecteuler folder, now includes all contest programming stuff

This commit is contained in:
2021-10-26 10:54:24 +02:00
parent 1aa6120838
commit e0c627a384
77 changed files with 203 additions and 67 deletions

40
projecteuler/053/main.py Normal file
View File

@@ -0,0 +1,40 @@
'''
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()