Skip to content

Add optimized prime number checking - #192

Merged
codepiyusss merged 1 commit into
codepiyusss:mainfrom
prash-code-19:fix/prime-number-optmization
Dec 4, 2026
Merged

codepiyusss merged 1 commit into
codepiyusss:mainfrom
prash-code-19:fix/prime-number-optmization

Conversation

@prash-code-19

Copy link
Copy Markdown
Contributor

What does this PR do?

Uses the 6k +/- 1 candidate sequence to reduce unnecessary divisor checks, while ensuring candidates are tested only up to the square root of the input. Adds CLI coverage for a prime number and a below-2 edge case.

Validation:

  • pytest — passed (183 passed in 2.54s).
  • .\.venv\Scripts\python.exe -m pre_commit run --files fixit/primes.py tests/test_cli.py — passed.
  • python -m pre_commit run --all-files — failed on an unrelated Ruff unused-import error in fixit/textutils.py.

Related issue

Closes #100

Checklist

  • I commented on the issue first and was assigned
  • I removed the xfail marker (if fixing a bug)
  • I added or updated tests
  • pytest passes locally
  • This PR only addresses one issue

@codepiyusss
codepiyusss merged commit d14e059 into codepiyusss:main Dec 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: add a prime number checker command

2 participants