Unify the various versions of is_prime() by humblepenguinn · Pull Request #5642 · TheAlgorithms/Python · GitHub
Skip to content

Unify the various versions of is_prime() - #5642

Closed
humblepenguinn wants to merge 1 commit into
TheAlgorithms:masterfrom
humblepenguinn:humblepenguin
Closed

humblepenguinn wants to merge 1 commit into
TheAlgorithms:masterfrom
humblepenguinn:humblepenguin

Conversation

@humblepenguinn

@humblepenguinn humblepenguinn commented Oct 28, 2021

Copy link
Copy Markdown

Describe your change:

Fixes: #5488

The issue #5488 stated that there were a lot of prime functions in the repository, this PR solves that issue by unifying all the functions into one prime check function. The unified prime_check function takes O(sqrt(n)). Some special prime functions were left alone.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@ghost ghost added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Oct 28, 2021
@cclauss cclauss changed the title Fix #5488 Unify the various versions of is_prime() Oct 28, 2021
@cclauss

cclauss commented Oct 28, 2021

Copy link
Copy Markdown
Member

@cclauss
cclauss requested a review from poyea October 28, 2021 17:51
@ghost ghost added the tests are failing Do not merge until tests pass label Oct 28, 2021
@humblepenguinn

Copy link
Copy Markdown
Author

@humblepenguinn
humblepenguinn deleted the humblepenguin branch October 29, 2021 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants