- Choose a race mode, keep all four algorithms on, and run the default target once.
- Check the winner card, then compare the chart and table together instead of reading one number in isolation.
- Load another sample or copy the URL when you want to reuse the same classroom setup.
Classroom presets: start with one all-method race, then switch to a small fixed-digits comparison for discussion.
Use the same time budget for every algorithm and compare the number of matching digits reached.
Ask which algorithm reaches the same digit target first. This phase keeps the target small on purpose.
Lower values produce denser chart points. Higher values reduce noise in the log and CSV.
Keep all four selected for the clearest comparison. Remove one only when you want to focus on a specific gap.
Race chart
The chart uses elapsed time on the x-axis and matching digits on the y-axis. It is meant for trend reading, not for claiming exact performance on every device.
Comparison table
| Algorithm | Estimate | Absolute error | Matching decimals | Iterations | Wall ms | Compute ms | Status |
|---|
Four methods and comparison limits
- Gregory–Leibniz series:
4 × (1 − 1/3 + 1/5 − …). It is easy to understand but needs many terms before more decimal digits become correct. - Nilakantha series:
3 + 4/(2·3·4) − 4/(4·5·6) + …. It usually converges much faster than Gregory. - Machin formula:
16 arctan(1/5) − 4 arctan(1/239). The implementation evaluates this classic Machin identity with series. - Chudnovsky formula: It converges extremely quickly. This race uses a lightweight JavaScript Number implementation, not the BigInt/binary-splitting implementation used for large digit generation.
Calculations run in this browser. Shared URLs contain settings only and never auto-run. See the privacy policy for site measurement details. (privacy policy)
The chart and CSV contain sampled points at the selected interval plus one guaranteed final point for every algorithm.
Teacher notes
- Use fixed time when you want students to feel that “same effort” does not mean “same accuracy.”
- Use fixed digits when you want to shift the discussion from progress curves to target-reaching speed.
- Gregory remains valuable because its slowness makes convergence visible instead of invisible.
- Chudnovsky wins quickly here, but this phase still treats it as a comparison method, not as a giant digits generator.
Worksheet and slide prep
- Algebra worksheets
Turn “same effort, different accuracy” into a comparison question or a quick quiz prompt.
- Graph paper generator
Use it when students should sketch a winner line or annotate why one method pulled ahead.
- Quick charts
Paste the summary table into a simple chart for class slides or handouts.
FAQ
Is a 1,000 ms fixed-time budget the total duration of the whole race?
No. The budget is applied separately to every selected algorithm, and the algorithms run sequentially. Four algorithms with a 1,000 ms budget normally take about four seconds or more in total.
How are a winner, a tie, and no target reached determined?
Fixed time first selects the highest matching-decimal accuracy and then the smallest absolute error; methods whose accuracy and comparison error are equivalent are tied. Fixed decimal digits considers only algorithms that reached the target; if none did, there is no winner and the closest method is shown instead.
What are matching decimal digits?
The integer 3 is not counted. The value reports how many digits after the decimal point agree continuously with the reference pi under the documented rounding rule, up to the safe JavaScript Number limit.
Does an absolute error of zero mean the exact mathematical value of pi was found?
No. It means the estimate rounded to the same double-precision value as Math.PI. The mathematical error relative to the true irrational number is not zero.
Does a smaller iteration count always mean a more efficient algorithm?
No. One Gregory term, one Machin update, and one Chudnovsky term have different computational costs and add different amounts of information. Treat iterations as progress within each method.
Why is Gregory slow while Chudnovsky is fast?
Gregory improves only a little per term, whereas Chudnovsky is designed to add many correct digits per term. Browser implementation and device performance still affect elapsed time.
Will another device or browser produce the same winner?
Not necessarily. CPU speed, browser engine, tab load, power mode, timer resolution, and scheduling can change timing. Use the page to study convergence trends rather than claim a universal benchmark.
What is saved when I stop, share the URL, or export CSV?
Stop creates a consistent snapshot marked as incomplete. The URL shares normalized settings without auto-running. CSV contains sampled points plus one guaranteed final row and status for every algorithm.