Skip to content
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

Implemented improved algorithm using Numba for Project Euler Problem 73 #11204

Closed
wants to merge 12 commits into from
Closed

Implemented improved algorithm using Numba for Project Euler Problem 73 #11204

wants to merge 12 commits into from

Commits on Dec 7, 2023

  1. Implemented improved algorithm using Numba for Project Euler Problem 73

    Existing file with a Python solution to count fractions between 1/3 and 1/2 for denominators up to 12,000 using nested loops and the math module's gcd function. This approach iterates through all possible fractions and counts those meeting the specified criteria.
    
    Added an improved solution utilizing the Numba library for optimized performance. This implementation uses a Numba-optimized function solution decorated with @njit to compile the code to machine code, significantly improving execution speed. The algorithm employs a different approach to count fractions between 1/3 and 1/2. It utilizes a loop with numerator and denominator ranges to calculate the count, avoiding unnecessary iterations by counting the fractions directly meeting the criteria while leveraging Numba's JIT compilation for efficiency.
    
    Fixes #8594
    venkat1924 committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    e541045 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f00dbd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d6ab30 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d3f96f4 View commit details
    Browse the repository at this point in the history
  5. Changed the code to not use Numba, since that created issues during p…

    …ytest. This program still performs significantly faster than existing solution. Fixes #8594
    venkat1924 committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    52acb90 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1278112 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8f11b8c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    93dc2c4 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e965f3b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a4aca01 View commit details
    Browse the repository at this point in the history
  11. Fixed indentation.

    venkat1924 committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    4d99dab View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    95a7331 View commit details
    Browse the repository at this point in the history