From 09b62d589a818b2bcdd8e4f667079c32d068927f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 1 Aug 2016 14:49:38 +0200 Subject: [PATCH] first step --- .../hyperelliptic_curves/hyperelliptic_finite_field.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index ad5e02a75a1..8316d881fcd 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -1132,7 +1132,10 @@ def cardinality_exhaustive(self, extension_degree=1, algorithm=None): # begin with points at infinity (on the smooth model) if g == 1: # elliptic curves always have one smooth point at infinity - a += 1 + if K.degree() % 2: + a += 1 + elif K.characteristic() != 2: + a += 1 + legendre_symbol(a, K.cardinality()) else: # g > 1 # solve y^2 + y*h[g+1] == f[2*g+2], i.e., y^2 + r*y - s == 0