BEGINNER · 10 MIN · FREE LESSON
Euclidean GCD
Explore euclidean gcd through a visual, step-by-step model.
Loading interactive lesson…
BEGINNER · 10 MIN · FREE LESSON
Explore euclidean gcd through a visual, step-by-step model.
Loading interactive lesson…
Enter {"a":48,"b":18}. Inputs are nonnegative integers.
Common divisors survive a Euclidean remainder step.
Replacing (a,b) by (b,a mod b) keeps the common divisors and decreases the smaller positive operand.
Remainder operations, seed 42. Plotted sample sizes respect each lesson’s explicit input limits.
Keyboard: Space play/pause · ←/→ step · R restart · 1–5 speed. Reduced motion disables transitions.
Cut two ribbons into equal pieces; removing whole copies of the shorter ribbon does not change the largest shared piece size.
Keep the divisors. Shrink the numbers. Edit the validated input or seeded preset to explore a different case.
Predict the next arithmetic decision, cache victim, sample replacement or cluster assignment before revealing it.
Each Euclidean remainder reduces the positive operands quickly; consecutive Fibonacci numbers give the long-run logarithmic bound. The algorithm convention here returns zero for gcd(0,0). The chart names its counted or modeled work rather than pretending animation duration is a benchmark.
The four reference languages show the core operation; numeric bounds and state assumptions match the input help. Exact power examples use arbitrary-precision integers.
Use it for simplifying fractions, modular arithmetic and divisibility reasoning.
Avoid division by zero by testing b first. The demonstration accepts nonnegative integers; signed minimum values need care when taking absolute values.
Check the invariant and cost model, then explain one boundary case using the live counters.
MAKE IT STICK
Progress saves on this device and merges with your account after sign-in.
0 / 5000 · Saved on this device; synced when signed in.