aoc2021-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Common

Synopsis

Documentation

crt :: Integral a => (a, a) -> (a, a) -> (a, a) Source #

Chinese remainder theorem.

crt (r1, q1) (r2, q2) == (r3, q3) ==>

r3 mod q1 == r1 && q3 mod q1 == 0 && r3 mod q2 == r2 && q3 mod q2 == 0

egcd :: Integral a => a -> a -> (a, a, a) Source #

Extended GCD.

gcd a b == (s, t, g) ==> a * s + b * t == g