Collatz Conjecture Calculator

Enter a positive integer and generate its Collatz sequence (n → n/2 if even, n → 3n+1 if odd) until it reaches 1, tracking the step count and peak value along the way.

Quick Facts

Rule
n → n/2 if even, n → 3n+1 if odd
Repeating this step is conjectured to always reach 1, no matter the starting positive integer.
Verification
No general proof exists
Computer searches have confirmed convergence for every starting value up to at least 2^68, but that is not a proof for all positive integers.

Your Results

Calculated
Total steps
-
Steps until the sequence reaches 1
Peak value
-
Highest number reached in the sequence
Odd steps (3n+1)
-
Times the "3n+1" rule was applied
Even steps (n/2)
-
Times the "n/2" rule was applied

Ready

Enter a starting number and press Calculate to generate its Collatz sequence.

How the Collatz Conjecture works

The Collatz conjecture (also called the 3n+1 problem, the Ulam conjecture, or the hailstone sequence) asks a simple question: starting from any positive integer, if you keep applying one rule, do you always eventually reach 1? This calculator builds the sequence for you and reports how long it takes and how high it climbs along the way.

The rule

For a positive integer n, repeat the following step until n equals 1:

  • If n is even, the next term is n ÷ 2.
  • If n is odd, the next term is 3n + 1.

Formally, f(n) = n/2 when n is even, and f(n) = 3n + 1 when n is odd. Every starting value tested so far eventually lands on 1, then would cycle 4 → 2 → 1 forever, which is why the sequence is defined to stop the first time it reaches 1.

What the calculator reports

Enter a starting number and the calculator runs the rule repeatedly, tracking the total number of steps (the "total stopping time") needed to reach 1, the peak value the sequence reaches before coming back down, and how many of those steps were odd-number steps (3n+1) versus even-number steps (n/2). The sequence terms are listed in the result summary, up to the display limit you choose, so you can trace the path term by term.

Why the numbers can surprise you

Small starting numbers can still produce large, erratic climbs before collapsing to 1. The classic example is 27: it looks unremarkable, but its sequence climbs to a peak of 9,232 and takes 111 steps to finally reach 1 — far more than most nearby numbers. There is no simple formula that predicts the step count or peak value from n alone, which is part of what makes the sequence interesting to explore.

Is it proven?

No. The Collatz conjecture remains unproven for all positive integers, despite being checked by computer for an enormous range of starting values — published searches have verified it for every starting number up to at least 2^68 (roughly 295 quintillion). Verifying a huge range does not amount to a mathematical proof; a single undiscovered counterexample, however large, would disprove it.

Frequently Asked Questions

What is the Collatz conjecture?
It is the claim that if you start from any positive integer and repeatedly apply the rule "halve it if even, triple it and add 1 if odd," you will always eventually reach 1. It is also known as the 3n+1 problem, the Ulam conjecture, or the hailstone problem, and remains one of the best-known unsolved problems in mathematics.
How many steps does it take to reach 1?
It varies a lot and is not predictable from a simple formula. This calculator counts every application of the rule as one step — for example, starting from 27 takes 111 steps and peaks at 9,232 before dropping to 1, even though 27 is a small number.
Has the Collatz conjecture been proven?
No. No general proof exists for all positive integers. Computer searches have verified it holds for every starting value up to extremely large bounds (published results cover values up to at least 2^68), but that is empirical confirmation, not a proof — a counterexample outside the checked range would still be possible in principle.
Why does the sequence stop at 1 instead of continuing?
Once a Collatz sequence reaches 1, applying the rule forever repeats the loop 1, 4, 2, 1, 4, 2, 1 and so on. By convention, the sequence and the step count stop the first time the value hits 1, since continuing would just cycle without new information.