File tree 1 file changed +4
-0
lines changed
project_euler/problem_073
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 18
18
19
19
from math import gcd
20
20
21
+
21
22
def slow_solution (max_d : int = 12_000 ) -> int :
22
23
"""
23
24
Returns number of fractions lie between 1/3 and 1/2 in the sorted set
@@ -40,6 +41,7 @@ def slow_solution(max_d: int = 12_000) -> int:
40
41
fractions_number += 1
41
42
return fractions_number
42
43
44
+
43
45
def solution (max_d : int = 12_000 ) -> int :
44
46
"""
45
47
Returns number of fractions lie between 1/3 and 1/2 in the sorted set
@@ -71,6 +73,7 @@ def solution(max_d: int = 12_000) -> int:
71
73
fractions_number += 1
72
74
return fractions_number
73
75
76
+
74
77
def benchmark () -> None :
75
78
"""
76
79
Benchmarks
@@ -86,6 +89,7 @@ def benchmark() -> None:
86
89
print (f"slow_solution : { timeit ('slow_solution()' , globals = globals (), number = 10 )} " )
87
90
print (f"solution : { timeit ('solution()' , globals = globals (), number = 10 )} " )
88
91
92
+
89
93
if __name__ == "__main__" :
90
94
print (f"{ solution () = } " )
91
95
benchmark ()
You can’t perform that action at this time.
0 commit comments