Understanding the Collatz conjecture calculator — concept and principle
This calculator runs the Collatz 3n + 1 rule from any positive whole number and reports how many steps it takes to reach 1, the highest value on the way, the numbers of odd and even steps and the stopping time. Use it to explore one of the most famous unsolved problems in mathematics.
How it is calculated
If n is even: n → n ÷ 2
If n is odd: n → 3n + 1
Repeat until the value reaches 1 (then 4 → 2 → 1 repeats forever).
- Steps to reach 1 = total stopping time = odd steps + even steps.
- Stopping time = the first step at which the value drops below the starting number.
- Exact whole-number arithmetic is used, so starting values up to 30 digits work.
The principle
The rule mixes a shrinking step (halving) with a growing one (3n + 1, which is always followed by at least one halving, since 3n + 1 is even when n is odd). On average the halvings win, which is a heuristic reason to expect every sequence to come down. The Collatz conjecture states that every positive whole number eventually reaches 1. It has been checked by computer for all starting values up to about 2⁷¹, but no proof is known; the paths are so irregular that neighbouring numbers can behave completely differently.
Worked example
Default input: n = 27.
- The sequence starts 27 → 82 → 41 → 124 → 62 → 31 → 94 → 47 → 142 → 71 → …
- It climbs and falls for a long time, reaching its highest value 9,232 at step 77.
- It first drops below 27 at step 96 (the stopping time).
- It reaches 1 after 111 steps: 41 odd steps (3n + 1) and 70 even steps (÷ 2).
How to read the result
Small starting numbers can produce surprisingly long paths: 27 takes 111 steps while 26 takes only 10. The highest value shows how far a path can climb before falling. Powers of 2 come straight down, since every step is a halving. Comparing nearby numbers is a good way to see how unpredictable the paths are.
Common mistakes
- Forgetting to multiply by 3 and add 1 for odd numbers, or adding 1 before multiplying.
- Counting the starting number as a step.
- Confusing the stopping time with the total number of steps.
- Treating computer checks as a proof.
Frequently asked questions
What is the Collatz conjecture?
The claim that repeatedly halving even numbers and tripling-plus-one odd numbers always ends at 1.
Why is 27 famous in the Collatz problem?
It takes 111 steps and climbs to 9,232, very long for such a small start.
Has the Collatz conjecture been proved?
No. It has been checked for enormous ranges of numbers, but there is no proof.
Sources: E. W. Weisstein, "Collatz Problem", Wolfram MathWorld