Source: https://irem.univ-reunion.fr/IMG/pdf/info_a45_fraction_irreductible_avec_scratch.pdf