A mason is tiling the floor of a courtyard that is 48 feet long and 18 feet wide. He wants every tile to be a square, all the same size, as big as possible, and he doesn't want to cut a single one. What size should he ask the shop for? Try a few. A 2-foot tile works: 24 along, 9 across. A 3-foot tile works too. A 9-foot tile fits across the width (18 = 2 × 9) but not along the length, because 48 is not a multiple of 9. The biggest that works is 6 feet: eight tiles along, three across. That number is the greatest common divisor of 48 and 18, the GCD, and bank exams often call it the HCF. More than two thousand years ago Euclid found a way to get it without trying anything at all, and his way turns out to be a recursive function so short that you can learn it in one sitting.
Last lesson you met recursion and set it against loops. This lesson puts it to work on two famous problems: Euclid's GCD, which is a loop wearing a recursion's clothes, and the Tower of Hanoi, a puzzle that is awkward with loops and almost effortless with recursion. Then we turn to a question that has been waiting since the first lesson of this series. When a function has a variable called total, who else can see it, and does it still exist after the function returns? That is scope and storage classes, and a good share of the MCQs and short written answers on functions come from exactly there.