Skip to content
AZ Tools

Collatz Conjecture (3n+1) Sequence

Generate the Collatz sequence for any positive integer — halve when even, triple-plus-one when odd — with step count, peak value and the full path to 1.

Steps to 1111
Peak value9232
Terms112
Sequence

How to use

  1. Enter a positive whole number.
  2. Read the number of steps, the peak value and the sequence length.
  3. Scroll the full sequence and copy it with one click.
  4. Try famous starters like 27 (111 steps, peak 9232) to see how wildly the path can swing.

About this tool

Show

The Collatz conjecture, also known as the 3n+1 problem or the hailstone sequence, applies a rule a child can follow to a positive integer: if it is even, halve it; if it is odd, triple it and add one. Repeat. Every number anyone has ever tried eventually reaches 1. Nobody can prove that every number does. Enter a starting value and this tool lists the whole trajectory, counts the steps to 1, and reports the highest value reached on the way.

The name "hailstone" comes from the shape of those trajectories: numbers rise and fall unpredictably, like hail carried up and down in a storm cloud, before finally dropping. Starting from 27 is the standard demonstration — a small, unremarkable number that takes 111 steps and climbs as high as 9,232 before coming down. Adjacent starting values give wildly different answers, and there is no known way to predict either the step count or the peak without simply running the sequence.

The conjecture has been verified by computer for every starting value up to roughly 2.95 × 10^20, which is 2^68, and that proves nothing at all about the numbers beyond. This is the gap between evidence and proof in its purest form, and it has defeated everyone who has tried: Erdős said mathematics is not yet ripe for such problems and offered money for a solution he did not expect to pay out. The strongest modern result, from Terence Tao in 2019, is that almost all starting values eventually reach almost bounded numbers — a genuine advance that still leaves the conjecture open.

Values are handled as arbitrary-precision integers, so the peaks are exact rather than rounded. That matters more than it sounds: the peak of a trajectory can be enormously larger than its starting point, and a calculator working in floating point starts silently corrupting digits well before it runs out of range. Starting from 871 the sequence takes 178 steps and reaches 190,996, and there are ordinary-looking starting values whose peaks pass what a double can represent exactly. Everything is computed in your browser.

Frequently asked questions

What is the rule exactly?

Start with any positive integer n. If n is even, the next term is n / 2; if n is odd, the next term is 3n + 1. Repeat until you reach 1. The number of steps to reach 1 is called the total stopping time.

Does every number reach 1?

It is conjectured — and verified for every number ever tested by computers — but never proven in general. That open question is the Collatz conjecture.

Why does 27 take so long?

Although 27 is small, its sequence climbs to a peak of 9232 and takes 111 steps before falling to 1, which makes it a popular example of how unpredictable the path can be.

Why is a problem this simple still open?

Because the two operations pull in different directions and nothing in the process gives a quantity that always decreases — the usual way to prove a procedure terminates. Halving shrinks a number and the odd step grows it, and the sequence of which one applies is effectively unpredictable, so an argument that works for a family of numbers tends not to survive contact with the next family. Checking further and further by computer says nothing about whether some number, somewhere, escapes.

What are the peaks in the path actually showing?

The peak is how far the number climbs before it starts falling for good, and it can be enormously larger than the starting value — a starting point in the hundreds can pass a hundred thousand on the way down. That is why the peak matters in a program: the step count tells you how long a run takes, but the peak tells you how big an integer has to be to hold it.

Related tools