Afterglowscreensavers

Euclidean GCD Spiral Screensaver

The Euclidean GCD Spiral screensaver draws the real, 2,300-year-old Euclidean algorithm as nested shrinking squares, finding the greatest common divisor of two random numbers. It is free, runs in your browser, and ESC exits.

Live preview

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the Euclidean GCD Spiral screensaver works

The saver picks two real random numbers and draws them as a rectangle, then runs the true Euclidean algorithm on them.

Each step tiles the real larger side with as many copies of the smaller side as fit, exactly the geometric picture behind the algorithm's repeated division.

The leftover remainder becomes the next real side length, and the process repeats, spiraling the nested squares inward.

Once the remainder reaches zero, the last nonzero square is the real greatest common divisor; it holds briefly, then a fresh pair of numbers begins.

A worked example

Two numbers that share a large common factor collapse to their real GCD in just a couple of steps, while a pair of coprime numbers spiral through many more shrinking squares before reaching one.

Settings & tips

Frequently asked questions

Is this a real algorithm?
Yes — the real Euclidean algorithm, one of the oldest algorithms still in common use today.
What do the nested squares mean?
Each square is a real, literal geometric picture of one step of repeated division in the algorithm.
Is a key needed?
No — it is a pure local computation.
Is it free?
Yes — free, no download, in your browser.

← All Science & Research screensavers