Source: http://www.automaths.com/3/cours/3_Arithmetique_C.pdf