def gf_crt1(M, K):
 (E, S) = ([], [])
 p = prod(M, start=K.one)
 for m in M:
  E.append((p // m))
  S.append((K.gcdex(E[(-1)], m)[0] % m))
 return (p, E, S)

def gf_crt1 ( M , K ) : ( E , S ) = ( [ ] , [ ] ) p = prod ( M , start = K . one ) for m in M : E . append ( ( p // m ) ) S . append ( ( K . gcdex ( E [ ( - 1 ) ] , m ) [ 0 ] % m ) ) return ( p , E , S )
first part of the chinese remainder theorem .