#16880: previous_prime, previous_prime_power, next_prime_power
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.7
Component: number theory | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers: Jeroen Demeyer
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/16880 | 1e0956157ef8f49bc19eb145dc60589f8e59587a
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by jdemeyer):
* status: needs_review => needs_work
* reviewer: => Jeroen Demeyer
Comment:
`skept` -> `skipped`
This should be moved ''after'' the comparison with 2 (and `self` should be
compared with 2):
{{{
cdef Integer n = PY_NEW(Integer)
}}}
Another simplification that I missed: you can skip the block
{{{
if mpz_even_p(n.value):
if n.is_prime_power(proof=proof):
return n
mpz_add_ui(n.value, n.value, 1)
}}}
if you instead just add 2 if `self` was odd:
{{{
mpz_add_ui(n.value, self.value, 1 if mpz_even_p(self.value) else 2)
}}}
Then the `bit_index` should be based on the value of `self`, such that the
check works correctly if `self` was `2^n - 1`.
--
Ticket URL: <http://trac.sagemath.org/ticket/16880#comment:24>
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.