diff --git a/cmd/crt.go b/cmd/crt.go index df46965..35bdac1 100644 --- a/cmd/crt.go +++ b/cmd/crt.go @@ -95,14 +95,15 @@ func crt(cmd *cobra.Command, args []string) { log.Fatal("invalid input " + remainders[i]) } - if i != 0 { - x, N := crtSolve(a1, n1, a2, n2) - n1.Set(N) - a1.Set(x) - } else { + if i == 0 { a1.Set(a2) n1.Set(n2) + continue } + + x, N := crtSolve(a1, n1, a2, n2) + a1.Set(x) + n1.Set(N) } fmt.Println(a1)