Repository navigation
fix: allow equal-prime pairs in primelib Goldbach decomposition - #15555
Draft
mohammmad357 wants to merge 1 commit into
Draft
mohammmad357 wants to merge 1 commit into
mohammmad357 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change
maths.primelib.goldbachaccepts even integers greater than two, but itsinner search begins at
i + 1, excluding pairs with the same prime twice.Consequently 4 and 6 reach the final assertion with an empty answer instead of
returning
[2, 2]and[3, 3]. Startjatiso equal-prime pairs areconsidered. This is a one-line correctness fix; existing doctests are unchanged.
The existing result for 8 remains
[3, 5].Validation and limitations
Base
215c1f0710f610aaf5ebaeab04edacec3f5308cd, independent branchfix-goldbach-repeated-prime, one algorithm file only. I checked the openPR list and searched Goldbach issues before preparing this fix; no open PR
addressing this case was found.
On Python 3.13.7, a full import is blocked by unrelated unparenthesized
multi-exception syntax in
maths/greatest_common_divisor.py(requires 3.14+).For local evidence I compiled the unchanged function ASTs of
goldbach,get_prime_numbers,is_primeandis_even, with their real math.sqrtdependency. No function body was adapted or mocked:
with the requested sum; primality was checked with a separate isqrt-based
trial-division oracle.
git diff --checkpasses.This isolated check is not the full module or upstream Python 3.15t suite.
Ruff/pre-commit installation timed out downloading from files.pythonhosted.org;
these tools are unavailable locally. Kept as a draft pending upstream CI and
review. Prepared with AI coding assistance, with the test scope disclosed.
Checklist
No new algorithm or open issue is claimed. Full upstream automated testing
has not yet run; the scoped local doctest result is above.