#16878: faster is_prime
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: number theory | Resolution:
Keywords: | Merged in:
Authors: Vincent | Reviewers: Jeroen Demeyer
Delecroix, Jeroen Demeyer | Work issues:
Report Upstream: N/A | Commit:
Branch: | f0d716fd34029f65d0be0aa45d5cb1783f8da2f5
u/vdelecroix/16878 | Stopgaps:
Dependencies: #15767 |
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Replying to [comment:25 jdemeyer]:
> Replying to [comment:23 vdelecroix]:
> > Great! I especially like that now `isprimepower` is accessible.
> >
> > In my last commit, I added the keyword `certificate` to
`is_prime_power` in order to get back the pair (n,p) such that the integer
is p^n^ (following pari convention). I think it is worth it!
> I like the idea, but I'm not sure that I like the interface with the
`certificate` keyword.
>
> How about a separate method `write_as_prime_power()` (raising
`ArithmeticError` if it's not a prime power) or something?
Note that there is already `factor` that does the job. Moreover, having
two methods (`is_prime_power` and `write_as_prime_power`) with the exact
same code looks bad as well. From my implementation, it is clear that the
`certificate` keyword only modifies the output.
My design choice also comes from the fact that this `certifcate` keyword
is already in use (see `sage.graphs` or `sage.combinat.designs`). I am not
particularly happy with it but I find it better than having two functions.
On the other hand, treating a Python exception takes time, and this
`is_prime_power` is the kind of function that I might use in time critical
code.
Vincent
--
Ticket URL: <http://trac.sagemath.org/ticket/16878#comment:27>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.