Source: https://moodle.umontpellier.fr/pluginfile.php/1474719/mod_label/intro/DemiPgcd.pdf