From 7052c2550a33db156635e11330c448cd236dbed0 Mon Sep 17 00:00:00 2001 From: Giacomo Pope Date: Sun, 25 Feb 2024 21:21:12 +0000 Subject: [PATCH] Fix #37471 --- src/sage/schemes/elliptic_curves/cm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 1f0fd8bd34e..a0349fa223d 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -264,14 +264,15 @@ def is_HCP(f, check_monic_irreducible=True): # Compute X^p-X mod fp z = fp.parent().gen() r = pow(z, p, fp) - z - d = r.gcd(fp).degree() # number of roots mod p + r = r.gcd(fp) + d = r.degree() # number of roots mod p if d == 0: continue - if not fp.is_squarefree(): + if not r.is_squarefree(): continue if d < h and d not in h2list: return zero - jp = fp.any_root(degree=1, assume_squarefree=True, assume_distinct_deg=True) + jp = r.any_root(degree=1, assume_squarefree=True, assume_distinct_deg=True) E = EllipticCurve(j=jp) if E.is_supersingular(): continue