AZ Tools

Collatz Conjecture (3n+1) Sequence

Everyday

The Collatz conjecture, also called the 3n+1 problem or the hailstone sequence, applies a simple rule to a positive integer: if it is even, divide by two; if it is odd, multiply by three and add one. Repeat and, as far as anyone has tested, you always reach 1. Enter a starting number and this tool lists the entire sequence, counts the steps (the stopping time), and reports the highest value reached along the way. Arbitrarily large numbers are handled exactly with big integers. Everything is computed locally in your browser.

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.

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.

Related tools