Source: https://w3.mi.parisdescartes.fr/~bouzy/Doc/ProgC/2017-2018/Seance8-pft/Cours/seance8-pft.pdf