StatGardenREF. DESK
Calculators/Maths/Collatz conjecture (3n+1)
Maths

Collatz conjecture (3n+1) calculator

Steps to reach 1 by halving even numbers and applying 3n + 1 to odd ones.

Published 4 August 2026 · Updated 24 September 2026

What this calculator does

The Collatz rule is about as simple as a rule gets. Take a positive whole number. If it is even, halve it. If it is odd, triple it and add one. Repeat. Every starting value anyone has ever tested eventually arrives at 1, and yet nobody has proved that every value must.

What makes the problem interesting is how unruly the path is. Modest starting numbers can take hundreds of steps and climb into the hundreds of thousands before collapsing back down, and two neighbouring numbers can behave nothing alike. This calculator runs the sequence, counts the steps and records the highest value reached on the way.

The formula

FormulaWhile n ≠ 1: n → n/2 if n is even, n → 3n + 1 if n is odd

Starting from the number entered, one of two rules is applied at each step: halve the value if it is even, or multiply by three and add one if it is odd. This repeats until the value reaches 1. The steps taken are counted as the stopping time, and the largest value seen anywhere in the sequence is tracked separately. The run is abandoned after 100,000 steps if 1 has not been reached, a limit no tested starting value has ever come close to needing.

TermMeaning
Stopping timeThe number of steps taken to reach 1 from the starting value.
Peak valueThe largest number reached anywhere in the sequence, which is often far above the starting value.
3n + 1 stepThe rule applied to odd numbers, the only step in the process that makes the value larger.
ConjectureA statement believed true and supported by evidence, but not proved. The Collatz conjecture is that every positive starting value reaches 1.

The inputs explained

FieldWhat to enter
Starting number (positive integer)The number to start from, a positive whole number. Anything entered is rounded and its sign ignored.

When to use it

Exploring how erratic the sequences are

Running several nearby starting values in turn is the quickest way to see that stopping time has no smooth relationship to the starting number, which is the feature that has kept the problem open.

Checking a hand-worked sequence

The rule is easy to apply and easy to slip up on, particularly over a long run. Comparing a hand-written sequence against the full list here catches a dropped or doubled step.

Teaching iteration and loops

The Collatz sequence is a standard first exercise in writing a loop with a condition inside it, and having the correct step count and peak value to check against makes the exercise self-marking.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How long does the 3n + 1 sequence take from different starting numbers?

Five starting values, including a neighbouring pair, and what each takes to reach 1.

Stopping times and peaks
Starting numberStopping time (steps to reach 1)Peak value reachedTotal terms
68169
7165217
271119,232112
971189,232119
871178190,996179
Nothing about the starting number predicts the result. 6 finishes in 8 steps, while 7 right next to it takes 16. 27 needs 111 steps and climbs to 9,232, and 97 reaches that identical peak of 9,232 because its path merges into the same trajectory before coming down. 871 takes 178 steps and passes 190,996 on the way.

Questions

Has the Collatz conjecture been proved?

No. It has been checked by computer for every starting value up to extremely large bounds without a single exception, but verification is not proof, and no argument covering all numbers has been found. It is one of the best known open problems in mathematics precisely because it is so easy to state.

What is the stopping time?

The number of steps taken to get from the starting value to 1. Halving counts as a step and the 3n + 1 rule counts as a step, so the stopping time is one less than the total number of terms in the sequence.

Why does every sequence end 4, 2, 1?

Because 1 is odd, the rule sends it to 4, which halves to 2 and then to 1 again. That three-term loop is where every sequence lands, and reaching any power of 2 anywhere along the way guarantees a clean run of halvings straight down into it.

Can the sequence go up forever?

Nobody knows, and that is the conjecture. It would also be enough to find a loop other than 4, 2, 1. Neither has ever been observed, but neither has been ruled out either.

For another number-theory curiosity with a simple rule and surprising behaviour, see the perfect number calculator. For a sequence that grows predictably instead, see the Fibonacci sequence calculator.