Source: https://coopersnotes.net/docs/numbers/CHAP03%20Quadratic%20Congruences.pdf