Source: https://www.math.cmu.edu/~cargue/arml/archive/15-16/number-theory-09-13-15-solutions.pdf