Skip to content

Commit c518b47

Browse files
committed
use semi-primitive root as suggested by comment in code
1 parent 04232a4 commit c518b47

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/sage/schemes/elliptic_curves/isogeny_small_degree.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,14 +2397,18 @@ def is_kernel_polynomial(E, m, f):
23972397
if m == 2 or m == 3:
23982398
return True
23992399

2400-
# For each a in a set of generators of (Z/mZ)^* we check that the
2401-
# multiplication-by-a map permutes the roots of f. It would be
2402-
# enough to take a generating (Z/mZ)^*/{1,-1} but that is not
2403-
# implemented. If m is prime (or more generally, has a primitive
2404-
# root) then only one a will be needed.
2400+
# For each a in a set of generators of (Z/mZ)^*/{1,-1} we check
2401+
# that the multiplication-by-a map permutes the roots of f.
2402+
# If m is prime (or more generally, has a primitive root) then
2403+
# only one a will be needed.
24052404

2406-
from sage.rings.finite_rings.integer_mod_ring import Integers
2407-
for a in Integers(m).unit_gens():
2405+
if m & 1 and m.is_prime_power():
2406+
gens = _least_semi_primitive(m),
2407+
else:
2408+
from sage.rings.finite_rings.integer_mod_ring import Integers
2409+
gens = Integers(m).unit_gens()
2410+
2411+
for a in gens:
24082412
mu = E.multiplication_by_m(a, x_only=True)
24092413
if f( S(mu.numerator()) / S(mu.denominator()) ) != 0:
24102414
return False

0 commit comments

Comments
 (0)