Euclid’s Doodle – and writing a visualization with Matplotlib

On page 110 of Professor Stewart’s Casebook of Mathematical Mysteries, he shows a a neat visual way of calculating the GCD (Greatest common denominator, aka HCF, Highest common factor. Given a box with sides of two different lengths, draw squares from the lesser side until you can draw no more. Then continue from the corner the other direction. The smallest square has edge length of the GCD!

Continue reading “Euclid’s Doodle – and writing a visualization with Matplotlib”