Collatz sequence calculator
Halve if even, triple and add one if odd. See how many steps it takes to reach 1.
A whole number of 1 or more, up to 300 digits.
The Collatz sequence is the simplest unsolved problem in mathematics that a child can try: take a whole number, halve it if it is even, otherwise triple it and add one, and keep going. This page shows the full sequence for any start, counts the steps, finds the highest point and can search for the longest chain below a limit. The arithmetic is exact for numbers of up to 300 digits.
What is the Collatz conjecture?
Pick any positive whole number. If it is even, halve it; if it is odd, multiply it by 3 and add 1. Repeat. The Collatz conjecture says that you always end up at 1, after which the sequence cycles 1, 4, 2, 1. Lothar Collatz introduced the idea in 1937. It is also known as the 3n + 1 problem, the Syracuse problem, Ulam's problem and the hailstone sequence, because the values go up and down like a hailstone in a cloud before falling.
Has the Collatz conjecture been proved?
No. As of 2025, computers have checked every starting value up to 2⁷¹ (about 2.36 × 10²¹) and all of them reach 1 (D. Barina, The Journal of Supercomputing, 2025). That is evidence, not a proof, because a counterexample could be larger or a different loop could exist. Terence Tao proved in 2019 that almost all starting values come down to a small bound in a precise statistical sense, which is the strongest general result so far, but it does not settle every number. Paul Erdős is quoted as saying “Mathematics may not be ready for such problems.”
How many steps does 27 take?
111 steps, of which 41 are 3n + 1 steps and 70 are halvings. The sequence climbs to 9,232 at step 77 before it finally falls to 1, even though 27 is so small. Its first value below 27 appears at step 96. This is the classic example of how unpredictable the sequence is: 26 and 28 take far fewer steps.
What is the stopping time and the total stopping time?
The stopping time of n is the number of steps until the sequence first drops below n. The total stopping time is the number of steps until it reaches 1, which is the number this calculator shows as the answer. For 6 the sequence is 6, 3, 10, 5, 16, 8, 4, 2, 1: the total stopping time is 8 and the stopping time is 1, because 3 is the first value below 6. By convention the calculator reports 0 for the stopping time of 1.
Which starting number below one million takes the longest?
837,799, with 524 steps to reach 1. Its peak is 2,974,984,576. You can reproduce this with the “longest chain below a limit” tab; the search takes a fraction of a second in your browser. There is no formula for such records; they are found by computer search.
Why does the calculator handle such big numbers?
The values in a Collatz sequence can far exceed the largest integer that an ordinary computer number can store exactly (about 9 × 10¹⁵). The page uses arbitrary-precision integers, so every digit is exact even for a start with 300 digits. Chains of more than 200,000 steps are refused so that the page stays responsive.
Is there any use for the Collatz sequence?
Not in practice. It is a famous example of a problem that is easy to state, easy to try with a pencil and unsolved, which is why teachers use it to show how mathematicians experiment, look for patterns and meet the limits of what can be proved. Programming it is a standard exercise for loops, recursion and big integers.
The rule and the terms used
Write the rule as a function: C(n) = n ÷ 2 if n is even, and C(n) = 3n + 1 if n is odd. The sequence for a start n is n, C(n), C(C(n)), and so on. Steps is the index at which the value first equals 1. Peak is the largest value that appears, and the page also says at which step. Odd steps and halvings add up to the steps. Stopping time is the step at which the value first falls below the start. Some books use the shortcut form, where an odd step is written (3n + 1) ÷ 2 and counts as one step; then the number of steps is smaller, so compare counts only when the convention is the same. This page uses the form above, in which 27 takes 111 steps.
Worked example
Start with 6. It is even, so halve it: 3. Now 3 is odd: 3 × 3 + 1 = 10. Then 10 → 5 → 16 → 8 → 4 → 2 → 1. The whole sequence is 6, 3, 10, 5, 16, 8, 4, 2, 1: 8 steps, of which 2 is a 3n + 1 step and 6 are halvings, with a peak of 16. Starting at 27 is far more dramatic: 111 steps and a peak of 9,232, which is more than 340 times the start. Trying a few numbers by hand and then comparing with the table is a good way to see that neighbours can behave very differently.
What is known, and what is not
- Computer checks. As of 2025 every start up to 2⁷¹ has been verified to reach 1 (Barina). Earlier published limits were smaller, so older web pages quote lower numbers.
- Other loops. The only known cycle of positive numbers is 4, 2, 1. Published results rule out other cycles that are short in a specific technical sense; they do not rule out every long one.
- Almost all. Tao (2019, published in Forum of Mathematics, Pi, 2022) proved that almost all orbits, in the sense of logarithmic density, get below any function that grows to infinity however slowly. It is not the same as “every orbit reaches 1”.
- Difficulty. Jeffrey Lagarias (2010) called it “extraordinarily difficult … completely out of reach of present day mathematics”.
Common mistakes
- Calling a test a proof. Checking billions of numbers shows that no small counterexample exists. It cannot show that none exists.
- Mixing step conventions. A book or script that counts (3n + 1) ÷ 2 as one step will report fewer steps than this page for the same start. 27 takes 111 steps in the standard form used here.
- Overflow in your own program. Peaks grow fast; a 32-bit or even 64-bit integer overflows for some starts, which is why this page uses big integers. If your program disagrees with the table for a large start, check the integer type first.
- Starting at 0 or with a negative number. The conjecture is about positive integers, so the page accepts only whole numbers of 1 or more.
Sources: Wikipedia, “Collatz conjecture” (Collatz 1937; examples 27 and 837,799; verification up to 2⁷¹ credited to D. Barina, “Improved verification limit for the convergence of the Collatz conjecture”, The Journal of Supercomputing 81(7), article 810, 2025; Tao, “Almost all orbits of the Collatz map attain almost bounded values”, Forum of Mathematics, Pi, 2022). All counts on this page are computed by the calculator itself. Related: sequence calculator, Fibonacci calculator, prime number calculator, factorial calculator and modulo calculator.