Uh oh!
There was an error while loading. Please reload this page.
Euler 070 partial replacement of numpy loops. - #9055
Conversation
quant12345
commented
Sep 11, 2023
@cclauss two errors occur: numpy import connected why error? And it is not clear what the first error means? |
Uh oh!
There was an error while loading. Please reload this page.
cclauss
commented
Sep 11, 2023
@dhruvmanila is the use of |
dhruvmanila
commented
Sep 11, 2023
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 |
quant12345
commented
Sep 11, 2023
@cclauss@dhruvmanila |
quant12345
commented
Sep 11, 2023
Do I understand correctly that my changes have been accepted? If so, then this is my first pull request) |
cclauss
commented
Sep 11, 2023
This is |
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: