Skip to content

Commit 34313ac

Browse files
author
Noel Roemmele
committed
Replaced lcm with LCM_list. Changed test to see if solution is correct to make sure it works in every case.
1 parent 1e346b3 commit 34313ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sage/arith/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,10 +3757,10 @@ def CRT_vectors(X, moduli):
37573757
raise ValueError("number of moduli must equal length of X")
37583758
res = CRT_basis(moduli, require_coprime_moduli=False)
37593759
a = res[0]
3760-
modulus = lcm(moduli)
3760+
modulus = LCM_list(moduli)
37613761
candidate = [sum(a[i] * X[i][j] for i in range(n)) % modulus
37623762
for j in range(len(X[0]))]
3763-
if not res[1] and any(X[i][j] != candidate[j] % moduli[i] for i in range(n)
3763+
if not res[1] and any((X[i][j] - candidate[j]) % moduli[i] != 0 for i in range(n)
37643764
for j in range(len(X[i]))):
37653765
raise ValueError("solution does not exist")
37663766
return candidate

0 commit comments

Comments
 (0)