Euler 070 partial replacement of numpy loops.#9055
Euler 070 partial replacement of numpy loops.#9055cclauss merged 5 commits intoTheAlgorithms:masterfrom quant12345:euler-070
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 |
|
Do I understand correctly that my changes have been accepted? If so, then this is my first pull request) |
|
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: