Jump to content

Chinese remainder theorem: Difference between revisions

Updated to work with version 1.4 of Nim.
(Updated to work with version 1.4 of Nim.)
Line 1,343:
=={{header|Nim}}==
{{trans|C}}
<lang nim>proc mulInv(a0, b0: int): int =
var (a, b, x0) = (a0, b0, 0)
result = 1
Line 1,360:
for x in n: prod *= x
 
for i in 0 .. <n.len:
let p = prod div n[i]
sum += a[i] * mulInv(p, n[i]) * p
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.