Skip to content

Performance: 75% faster Project Euler 187 #10503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 15, 2023
Prev Previous commit
Next Next commit
Add doctest for calculate_prime_numbers
  • Loading branch information
ManpreetXSingh committed Oct 15, 2023
commit b7c204da4c79942c261d2b9864adca0c8ec3fb9a
6 changes: 6 additions & 0 deletions project_euler/problem_187/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def slow_calculate_prime_numbers(max_number: int) -> list[int]:

>>> slow_calculate_prime_numbers(10)
[2, 3, 5, 7]

>>> slow_calculate_prime_numbers(2)
[]
"""

# List containing a bool value for every number below max_number/2
Expand All @@ -42,6 +45,9 @@ def calculate_prime_numbers(max_number: int) -> list[int]:

>>> calculate_prime_numbers(10)
[2, 3, 5, 7]

>>> calculate_prime_numbers(2)
[]
"""

if max_number <= 2:
Expand Down