Source: https://www-fourier.ujf-grenoble.fr/~rjoly/Documents/Pedago/Stendhal/arithmetique2013.pdf