Source: http://www.i2m.univ-amu.fr/perso/maxime.hauray/enseignement/L1-MathGene/DM-Triplets_pyth.pdf