Collatz Steps Calculator
Count Hailstone steps to 1 with peak value shown.
What it does
The Collatz map iterates a simple rule: halve evens, triple odds and add one. Unproven conjecture says all positive starts reach 1. Small starts finish fast, some climb high first like 27 to 9232.
The tool above takes starting n and returns steps, peak, and terms. The default 6 matches the worked example, so the page opens showing 8 steps. Type a new n to update all three results.
Steps count transitions to 1. Terms add one for the start. Peak tracks the max seen. Here 6 runs 6,3,10,5,16,8,4,2,1 for 8 steps with peak 16. Odd steps jump up, evens grind down.
Use this to explore stopping times, verify OEIS A006577 values, and test loop guards. Large starts may exceed the 10000 step cap here and report an error instead of hanging.
This page shows the rules, one full hand checked example at 6, a reference table, and practice checks that run through the tool.
How to use
- Type starting n as a whole number.
- Keep n between 1 and 1e12.
- Read Steps as transitions to 1.
- Read Peak as max value seen.
- Read Terms as steps plus 1.
- Try 27 to see long climb to 9232.
Formula
- n
- Starting positive integer.
- steps
- Moves to reach 1.
- peak
- Largest value in the run.
Conjecture unproven but checked past 2e21 per literature. This tool caps at 10000 moves and reports overflow instead of looping.
Worked example
Example: n = 6
Run Collatz from 6 to 1.
- Start 6 even to 3 (1).
- 3 odd to 10 (2).
- 10 to 5 (3), 5 to 16 (4).
- 16 to 8 (5), 8 to 4 (6), 4 to 2 (7), 2 to 1 (8).
- Steps 8, terms 9.
- Peak max of run is 16.
Reference table
| n | Steps | Peak |
|---|---|---|
| 1 | 0 | 1 |
| 6 | 8 | 16 |
| 19 | 20 | 88 |
| 27 | 111 | 9,232 |
Limits
- Starts 1 to 1e12 here.
- 10000 step cap. Larger runs report overflow.
- No proof here, only iteration counts.
- Integers only. Fractions have no Collatz form here.
Common mistakes
- Counting terms instead of steps (off by one).
- Skipping the +1 on odd moves.
- Halving odd numbers by mistake.
- Expecting peak near start. 27 peaks at 9232.
- Running huge starts without a step cap.
Try it yourself
Quick checks. Answers sit tucked under each question.
Start 1?
Steps 0, peak 1, terms 1.
Start 27?
Steps 111, peak 9,232, terms 112.
Questions
6 steps?
8 steps to 1.
Peak?
Max seen. Here 16.
27?
111 steps with peak 9232.
Proven?
No. Open conjecture, checked very high.
Even odd?
Even halves, odd triples plus 1.
Cap?
10000 moves here.