minor updates

This commit is contained in:
2022-03-13 11:35:31 +01:00
parent 1e98a56325
commit a431ca9b92
4 changed files with 10 additions and 11 deletions

View File

@@ -1,8 +1,12 @@
# Chinese Remainder Theorem
def crt(a_i, m_i, M):
def crt(a_i, m_i):
if len(a_i)!=len(m_i):
raise Exception("error, a_i and m_i must be of the same length")
M=1
for i in range(len(m_i)):
M = M * m_i[i]
x = 0
for i in range(len(a_i)):
M_i = M/m_i[i]