a11x1 + ⋯ + a1nxn ≡ b1 (mod q1)
.
.
.
am1x1 + ⋯ + amnxn ≡ bm (mod qm)
b11x1 + ⋯ + b1nxn ≡ c1 (mod q)
.
.
.
bm1x1 + ⋯ + bmnxn ≡ cm (mod q)
P and Q are unimodular matrices such that PBQ = diag(d1,...,dr,0,...,0), where r = rank(B) and d1,...,dr are positive integers such that di divides di+1 for 1 ≤ i ≤ r-1.
Write X = QY and K = PC. Then we have the equivalent system of congrences
d1y1 ≡ k1 (mod q)
.
.
.
dryr ≡ kr (mod q)
0 ≡ kr+1 (mod q)
.
.
.
0 ≡ kn (mod q).
If r = n, we get e1···er solutions (mod q), otherwise we get e1···erqn-r solutions (mod q).
The augmented matrix [A|B] can be entered either
(i) as a string of m(n+1) integers separated by spaces, or
(ii) cut and pasted from a text file, with entries separated by spaces and each row ended by a newline.
The author is grateful to Alan Offer for programming assistance with the recursive construction of the cartesian product.
Last modified 13th June 2015
Return to main page