Skip to content

Commit 2ce4ddd

Browse files
committed
fix issue 37445
1 parent 09bcfdd commit 2ce4ddd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,18 @@ cdef class Polynomial(CommutativePolynomial):
21512151
True
21522152
sage: f % factor == 0
21532153
True
2154+
2155+
TESTS:
2156+
2157+
Ensure that :issue:`37445` is fixed::
2158+
2159+
sage: R.<x> = GF(13)[]
2160+
sage: def irr(d, R): return f.monic() if (f := R.random_element(d)).is_irreducible() else irr(d, R)
2161+
sage: f = prod(irr(6, R) for _ in range(10))
2162+
sage: irr = f._cantor_zassenhaus_split_to_irreducible(6)
2163+
sage: assert irr.degree() == 6
2164+
sage: assert f % irr == 0
2165+
sage: assert irr.is_irreducible()
21542166
"""
21552167
R = self.parent()
21562168
q = self.base_ring().order()
@@ -2174,7 +2186,7 @@ cdef class Polynomial(CommutativePolynomial):
21742186

21752187
# Need to handle odd and even characteristic separately
21762188
if q % 2:
2177-
h = self.gcd(pow(T, (q-1)//2, self) - 1)
2189+
h = self.gcd(pow(T, (q**degree-1)//2, self) - 1)
21782190
else:
21792191
# Compute the trace of T with field of order 2^k
21802192
# sum T^(2^i) for i in range (degree * k)

0 commit comments

Comments
 (0)