-
-
Notifications
You must be signed in to change notification settings - Fork 45.8k
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
Euler 070 partial replacement of numpy loops. #9055
Conversation
@cclauss two errors occur:
numpy import connected why error? And it is not clear what the first error means? |
@dhruvmanila is the use of |
I think it's fine to use external libraries but usually it's better to implement the solution on our own. That said, the CI is failing because it doesn't install any of the dependencies from If we were to go the route of installing external dependencies, I would take it case by case and declare a new |
@cclauss @dhruvmanila |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! Let's land this one!!
Do I understand correctly that my changes have been accepted? If so, then this is my first pull request) |
This is |
* Euler 070 partial replacement of numpy loops. * Update project_euler/problem_070/sol1.py * project_euler.yml: Upgrade actions/checkout@v4 and add numpy * Update project_euler.yml --------- Co-authored-by: Christian Clauss <[email protected]>
Describe your change:
Removed loop for filling 'totients' values. Instead, use: np.arange. The cycle for division without a remainder has also been removed: totients[j] // i. Instead, at each iteration, an array of indexes is created to select from the 'totients' array.
Speeds up calculations by 30%.
tests
Output:
Checklist: