Collatz Sequence Calculator | 3n+1 Conjecture, Stopping Time & Path
Explore the Collatz conjecture (3n+1 problem) for any positive integer. Computes the complete sequence path, stopping time, total steps, peak value, and odd-step count. Visualizes the trajectory and lets you compare stopping times across a range of starting values.
Collatz Sequence Calculator
Range Comparison — Stopping Times (1 to N)
What Is the Collatz Sequence Calculator | 3n+1 Conjecture, Stopping Time & Path?
The Collatz conjecture (also known as the 3n+1 problem or Syracuse problem) states that, starting from any positive integer n, repeatedly applying the Collatz function will eventually reach 1. Despite its simple rule, no proof exists yet. For every n tested (up to 2⁶⁸), the sequence terminates, but no one has proven it for all n. The stopping time is the number of steps to reach 1. The peak (or maximum) value can far exceed the starting number — n=27 reaches a peak of 9232 before descending.
Formula
If n is even: n → n/2 | If n is odd: n → 3n + 1 | Repeat until n = 1
How to Use
- 1
Type a positive integer n (1 to 1,000,000,000) into the input field or click one of the presets (n=27, n=871, n=6171).
- 2
Click Compute to run the Collatz algorithm and see the stopping time, peak value, odd/even step counts.
- 3
Read the sequence display — the first 50 steps are shown; for longer sequences, the remaining step count is noted.
- 4
Scroll to the Range Comparison section and set N (2–200) to compare stopping times for all starting values from 1 to N.
- 5
Click "1–50", "1–100", or "1–150" to load preset ranges into the bar chart immediately.
- 6
The bar chart shows each starting value n on the left, a bar proportional to its stopping time, and the exact count on the right.
- 7
Try n=27 (famous for 111 steps and a peak of 9232) and compare with its neighbors to see how erratic stopping times can be.
Enter any positive integer up to 1,000,000,000, click Compute, and explore the full sequence, stopping time, and range comparison chart.
Example Calculation
For n = 27: the sequence is 27 → 82 → 41 → 124 → 62 → 31 → 94 → 47 → 142 → 71 → 214 … (peaks at 9232 on step 76) → … → 1. Stopping time = 111 steps. Odd steps = 34, even steps = 77. Compare with n = 28: stopping time = 18 steps — a neighbour with a wildly shorter path.
Understanding Collatz Sequence | 3n+1 Conjecture, Stopping Time & Path
Famous Starting Values and Their Stopping Times
| n | Stopping Time | Peak Value | Peak Step | Notable For |
|---|---|---|---|---|
| 1 | 0 | 1 | 0 | Trivial fixed point |
| 2 | 1 | 2 | 0 | Shortest non-trivial path |
| 3 | 7 | 16 | 2 | First odd number > 1 |
| 27 | 111 | 9,232 | 76 | Famous for long path and high peak |
| 97 | 118 | 9,232 | 113 | Shares peak with n=27 |
| 871 | 178 | 190,996 | 170 | Highest peak for n < 1000 |
| 6171 | 261 | 975,400 | 258 | Long path under 10000 |
| 77031 | 350 | 21,933,016 | 348 | Record stopping time under 100000 |
Stopping Time Statistics for n = 1 to 20
| n | Stopping Time | Peak | Odd Steps | Even Steps |
|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 0 |
| 2 | 1 | 2 | 0 | 1 |
| 3 | 7 | 16 | 2 | 5 |
| 4 | 2 | 4 | 0 | 2 |
| 5 | 5 | 16 | 2 | 3 |
| 6 | 8 | 16 | 2 | 6 |
| 7 | 16 | 52 | 5 | 11 |
| 8 | 3 | 8 | 0 | 3 |
| 9 | 19 | 52 | 5 | 14 |
| 10 | 6 | 16 | 2 | 4 |
| 11 | 14 | 52 | 4 | 10 |
| 12 | 9 | 16 | 2 | 7 |
| 13 | 9 | 40 | 3 | 6 |
| 14 | 17 | 52 | 5 | 12 |
| 15 | 17 | 160 | 5 | 12 |
| 16 | 4 | 16 | 0 | 4 |
| 17 | 12 | 52 | 3 | 9 |
| 18 | 20 | 52 | 5 | 15 |
| 19 | 20 | 88 | 5 | 15 |
| 20 | 7 | 20 | 2 | 5 |
Key Facts and Related Sequences
- ›The Collatz function is T(n) = n/2 if n ≡ 0 (mod 2), or (3n+1)/2 if n ≡ 1 (mod 2) in its "shortcut" form, which skips the intermediate even number after each odd step.
- ›Stopping time records below 10⁶: the number 837799 has stopping time 524 and peak 2,974,984,576.
- ›The average stopping time for n < N grows roughly as 9.48 ln N.
- ›The total stopping time problem asks for the number of steps to enter the cycle {4, 2, 1}. The sequence A006577 in OEIS.
- ›Paul Erdős said "Mathematics is not yet ready for such problems" about the Collatz conjecture.
Frequently Asked Questions
Has the Collatz conjecture been proved?
No. Despite being verifiable for all n up to 2⁶⁸ and extensive partial results (including Tao's 2019 "almost all" proof), no complete proof or counterexample has been found. It remains one of the most famous unsolved problems in mathematics.
What is the "stopping time" of a number?
The stopping time is the number of Collatz steps required to reach 1 from a given starting value n. For example, n=1 has stopping time 0, n=2 has stopping time 1, and n=27 has stopping time 111.
Why does n=27 have such a long sequence?
n=27 is famous for its unexpectedly long journey: it requires 111 steps and reaches a peak of 9232 — more than 341× the starting value — before eventually descending to 1. This illustrates how stopping times are highly unpredictable from the starting value alone.
Can n ever increase indefinitely?
No counterexample has been found. For every n tested up to 2⁶⁸, the sequence always reaches 1. The conjecture asserts this holds for all positive integers, but the proof remains elusive.
What is the maximum value the calculator supports?
The calculator supports any positive integer up to 1,000,000,000 (10⁹), which fits exactly in JavaScript's 64-bit floating point. For safety, sequences are capped at 10,000 steps (though no number below 10⁹ is known to exceed this limit).
You Might Also Like
Explore 360+ Free Calculators
From math and science to finance and everyday life — all free, no account needed.