Worked examples, one step per line
Pick an example. The page runs that lab's own code on one input and writes out what it returns, a step at a time. The page does not grade a reader and it does not claim a learning outcome.
Euclid's algorithm
From the mathematics desk: The continued fraction of a rational
Each line is the identity dividend equals quotient times divisor plus remainder, with the remainder strictly smaller than the divisor. The last non-zero remainder is the gcd.
The result appears here when the page script runs.
How it is computed
Method
Start with the two integers. While the divisor is not zero, the quotient is the integer division and the remainder is dividend minus quotient times divisor. The next dividend is the old divisor and the next divisor is the remainder. Each line is checked before it is shown. The reduced ratio divides by the gcd.
The other examples load the script of the lab they come from and run it on one input. Each value in a line is read from what that run returns: the stacked ratios and their cents for the comma, the priors, products and normaliser for the update, the stored finishes for the tour, and the certificate and its reread for the prime. Where the same run gives a value two ways, such as the comma as a stack and as a quotient, the two are compared first, and a mismatch replaces the lines with a message.
Assumptions
Euclid runs here on the two integers in the form, and the continued-fraction page uses the same recurrence. The other inputs are fixed by their labs: the sound lab's twelve fifths, the first test of the decisions lab's screening example, the routing lab's four stops on one road, and the prime 113 from the mathematics desk.
Limits
No score is given to a reader. A worked line is not a credential.
Reproducibility
The example and Euclid's inputs are kept in the address bar, so the same link reruns the same calculation.