From 18134eec8c240f762465ec7d2b839b98ed41c280 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 12 Apr 2023 17:55:50 +0800 Subject: [PATCH] fix documentation and doctest for qfbcornacchia() -- see #35292 --- src/sage/quadratic_forms/binary_qf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py index 96247522baf..5715c8f2cf7 100755 --- a/src/sage/quadratic_forms/binary_qf.py +++ b/src/sage/quadratic_forms/binary_qf.py @@ -1573,9 +1573,10 @@ def solve_integer(self, n, *, algorithm="general"): sage: Q.solve_integer(773187972) # optional - sage.libs.pari (4919, 1337) - If `Q` is of the form `[1,0,c]` as above and `n` is a prime or - four times a prime, Cornacchia's algorithm can be used, which is - typically much faster than the general method:: + If `Q` is of the form `[1,0,c]` as above and `n` is a prime + (or four times a prime whenever `c \equiv 3 \pmod 4`), then + Cornacchia's algorithm can be used, which is typically much + faster than the general method:: sage: Q = BinaryQF([1, 0, 12345]) sage: n = 2^99 + 5273 @@ -1615,7 +1616,7 @@ def solve_integer(self, n, *, algorithm="general"): sage: abc = [1, 0, randrange(1,10^3)] sage: Q = BinaryQF(abc) sage: n = random_prime(10^9) - sage: if randrange(2): + sage: if Q[2] % 4 == 3 and randrange(2): ....: n *= 4 sage: xy1 = Q.solve_integer(n, algorithm='cornacchia') sage: xy1 is None or Q(*xy1) == n