How to use the collatz sequence calculator
- Enter a starting number, any whole number from 1 up to 30 digits. Commas and spaces are ignored.
- Read the number of steps to reach 1, the highest value reached and how many steps were halvings and how many were triplings.
- See the step at which the sequence first falls below the number you started with.
- The table lists the first 200 values, and the downloaded CSV holds the whole run.
Formula
if n is even, the next number is n / 2
if n is odd, the next number is 3 x n + 1
repeat until the number is 1
steps = number of moves made; peak = the largest value on the way
The Collatz conjecture says every positive whole number reaches 1 this way. It has been checked by computer for a very large range, but it has not been proved.
The run from 27
Starting at 27 the sequence goes 27, 82, 41, 124, 62, 31, 94, and on, climbing to a peak of 9,232 before it finally falls to 1. It takes 111 steps, of which 70 are halvings and 41 are triplings. It first drops below 27 at step 96. Starting at 97 takes 118 steps and also peaks at 9,232, and 871 takes 178 steps and peaks at 190,996.
Small numbers can behave very differently from their neighbors: 7 takes 16 steps and peaks at 52, while 989,345,275,647 takes 1,348 steps and peaks at about 1.22 quadrillion. A 29-digit number, 12,345,678,901,234,567,890,123,456,789, takes 546 steps. Each of these counts was checked against a plain Python loop.
Why it is called a hailstone sequence
The values rise and fall in a wandering path, a bit like a hailstone rising and falling in a storm cloud before it lands. A long run of odd numbers makes the sequence climb fast, because each odd step more than triples the number, while each halving cuts it down. The balance of the two decides how long the run is.
What the tool can and cannot show
Following a sequence for one number proves nothing about all numbers, and this tool has no way of finding a counterexample, since none is known. It follows the run exactly with whole-number arithmetic, so even very large values are never rounded. If a run is too long to finish, the tool says so. For more number puzzles, try the Fibonacci Calculator or the Prime Number Calculator.
More tools for playing with numbers
For more number patterns and conversions, try the Egyptian Fraction Decomposer, Gray Code Converter and Digit Grouping Converter.
Assumptions and limits
- The starting number is a whole number from 1 to 30 digits.
- Each value is computed exactly with whole-number arithmetic, with no rounding.
- The run stops when the value reaches 1 or when it passes the step limit of the tool.
- The table shows the first 200 values only; the CSV file has the whole run.
- The starting number in the form is an example. Try your own.
Frequently asked questions
Is the Collatz conjecture proved?
No. It has been checked by computer for an enormous range of starting values and always reached 1, but no one has found a proof that it holds for every whole number.
What is the total stopping time?
It is the number of steps to reach 1, which is the main figure shown here. A related measure, the stopping time, is the number of steps until the value first drops below the starting number.
Why do so many different numbers reach the same peak?
Once two runs land on the same value they follow the same path from then on. 27 and 97 both pass through 9,232, which is why they share a peak.
Does it work for zero or negative numbers?
Not in the usual form. Zero never changes, and negative numbers fall into other loops that do not reach 1, so the tool asks for a positive whole number.