-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Weaken
find_first_factor
contract to any prime
It turns out, none of our use cases require us to find the _first_ factor. All we really need is to find _any prime_ factor. (And if the number itself is prime, of course, then the only option will be to return the number itself.) Weakening this contract enables us to take advantage of faster factoring methods that aren't guaranteed to find the _smallest_ factor. Obviously, we could use these faster methods to build a function that satisfies our old contract, by repeatedly applying them to _fully_ factor a number, and then taking the smallest one. But this adds extra computation for no clear benefit. Helps #217.
- Loading branch information
Showing
3 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters