prime(n) is the n-th prime, and valuation(n, p) the p-adic valuation - #1453
Merged
Merged
Conversation
A function of its own -- PP carries no order -- with SymPy's spelling: prime(1) is 2, prime(25) is 97, NaN off the positive whole numbers, and left as written for a symbol or an index past a million, where the table would be built towards it. Its codomain is Domain.Prime. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
The exponent of the prime p in n: valuation(12, 2) is 2, valuation(12, 5) is 0, +oo at n = 0 by the convention, NaN where p is not prime. Sullivan and Mackey's Ex 5.5.1 writes n = 2^m (2 l + 1) with m the 2-adic valuation, and n = product(p^valuation(n, p), p in PP) is what a factorisation says over the set of primes. v_p(n) in LaTeX, sympy.multiplicity in SymPy. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.
The two functions #1450's questions come down to, beside the set #1452 added.
prime(n)— then-th prime, SymPy's spelling:prime(1)is2,prime(25)is97,prime(1000)is7919;NaNoff the positive whole numbers; left as written for a symbol or an index past a million, where the table would be built towards it. A function of its own rather than an operation onPP, which carries no order; its codomain isDomain.Prime. The table behind it,Primes.GetPrime, existed already for the continued-fraction code — this exposes it.\operatorname{prime}(n)in LaTeX,sympy.prime(n).valuation(n, p)— thep-adic valuation, the exponent of the primepinn:valuation(12, 2)is2,valuation(12, 5)is0,valuation(-40, 2)is3,+ooatn = 0by the convention every text uses,NaNwherepis not prime. Sullivan and Mackey's Ex 5.5.1 writesn = 2^m (2 l + 1)withmthe 2-adic valuation, andn = product(p^valuation(n, p), p in PP)is what a factorisation says over the set — theproduct(f, p in S)binder itself is the multiplicative twin of #1435'sunionand waits for #1019's indexed-family convention.v_p(n)in LaTeX,sympy.multiplicity(p, n).Both are nodes through every pipeline (
WritingARule.md's buildable count goes 48 → 50), with 22 rows inPrimeSetTest,Syntax.mdandBREAKING-CHANGES.md. Full suite 12499 passed; the allocation gate passes on all 19 gated benchmarks —ParseHard+0.7%, which is #1441's ~12 KB per'name('token, twice.Part of #1450.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura