Source: https://lyon8-2.circo.ac-lyon.fr/spip/IMG/pdf/resolution_de_problemes_-_cycle_3_-_1ere_partie.pdf