Source: https://www.lamsade.dauphine.fr/~labidi/Cours/DEGEAD2_-_Informatique/TD - TP/TDTP_binaire/exosBinaire.pdf