A Collatz conjecture calculator follows the famous 3n + 1 sequence from any starting number. If the number is even, it halves it. If it is odd, it triples it and adds 1. It repeats until it reaches 1, and shows the number of steps, the highest value reached, the stopping time and the whole sequence. Enter a number and press the button. The rules follow the Wikipedia page on the Collatz conjecture, and the work is done in your browser.
How to use the Collatz conjecture calculator
- Choose the rule: the standard rule or the shortcut that halves after tripling.
- Enter a starting number, any whole number from 1.
- Press Calculate.
The rule and the conjecture
The page states the rule in two lines: if the number is even, divide it by two, and if it is odd, triple it and add one. The conjecture, which is unproven, says that every positive whole number eventually reaches 1 under these steps. Once you reach 1, the sequence goes 1, 4, 2, 1 and repeats, and 1, 2 and 4 form the only known cycle. The page reports that the conjecture has been checked by computer for every number up to about 2.36 × 10²¹, with no exception found, and a result of Terras shows that almost every number has a finite stopping time.
Worked examples
Start with 12. The sequence is 12, 6, 3, 10, 5, 16, 8, 4, 2, 1, which reaches 1 in 9 steps, as the page shows. Start with 19 and you get 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, which takes 20 steps. The famous example is 27: the page notes that it takes 111 steps, 41 of them on odd numbers, and climbs as high as 9,232 before it falls to 1. A tiny start can produce a surprisingly tall journey, which is why the sequence is nicknamed hailstone numbers. The calculator confirms each of these figures.
Stopping time and total stopping time
The page defines the stopping time of n as the smallest number of steps after which the sequence drops below n, and the total stopping time as the number of steps to reach 1. For 27, the stopping time is much shorter than the total of 111 steps. For a power of 2, the total stopping time is just the exponent, because each step halves the number: 1,024 reaches 1 in 10 steps. The page also lists the number below each bound with the longest total stopping time. Below 100 it is 97, with 118 steps; below 1,000 it is 871 with 178 steps; and below 10⁶ it is 837,799 with 524 steps. You can check these in the calculator.
The shortcut form
Because 3n + 1 is always even when n is odd, the next step is always a halving. The page therefore also gives the shortcut form, in which an odd number n goes to (3n + 1)/2 in one step, and says that this gives smaller stopping times. For 12, the shortcut sequence is 12, 6, 3, 5, 8, 4, 2, 1, which takes 7 steps. The calculator offers both forms, and the highest value reached is the same in both.
Why people study it
The Collatz conjecture is easy to state and a child can check it by hand, yet it has resisted the efforts of mathematicians for decades. It is a good example of how simple rules can produce complex behavior, and it is a popular programming exercise. Exploring it with a calculator lets you look for patterns, such as which numbers take unusually long to fall, or how often the sequence climbs.
Reading the results
The first figure is the number of steps to reach 1. Next comes the highest value the sequence reaches, then the split of the steps between odd and even numbers: every odd step triples and adds 1, and every even step halves. A sequence has to halve more often than it triples for it to come down, and the counts for 27, with 41 odd and 70 even steps, show the balance. The stopping time tells you when the sequence first falls below its start. For many numbers this happens within a few steps, but for some it takes much longer.
Patterns to look for
Try the numbers around a power of two. The number 64 falls straight down in 6 steps, but 65 takes 27. Try 255, which appears on the page's list of numbers that set a new record for the highest peak. Try a long chain of consecutive numbers and see how many share the same step count. Some numbers join the path of a smaller number after a few steps, which is why the counts for neighboring numbers are so often similar. Exploring these patterns shows why the conjecture is so hard to prove, since there is no obvious rule that describes how many steps a number needs.
Why the sequence is nicknamed hailstone
A hailstone in a cloud is carried up and down several times before it finally falls, and the Collatz sequence behaves in a similar way, rising and dropping in an irregular pattern before it ends at 1. The tall climb of 27, up to 9,232 before the long fall, is a typical example. The calculator shows the full sequence for the first 60 numbers, so you can see the ups and downs.
Common mistakes
- Believing the conjecture is proved. It has been checked by computer, but not proved.
- Mixing up the two rules. The shortcut counts the halving as part of the odd step.
- Stopping at 4. The sequence ends when it reaches 1.
- Starting with 0. The rule needs a positive whole number.
- Counting the start as a step. Steps are the moves between numbers.
What next
Use this often? Add Collatz Conj to your Home screen.
Frequently asked questions
What is the Collatz conjecture calculator?
A tool that follows the 3n + 1 sequence to 1. The conjecture itself is the claim that, if you halve even numbers and replace odd numbers n by 3n + 1, every positive whole number reaches 1. It is unproven.
How many steps does 27 take?
111 steps, 41 of them on odd numbers, reaching a highest value of 9,232 before falling to 1.
What is the Collatz sequence for 12?
12, 6, 3, 10, 5, 16, 8, 4, 2, 1, which is 9 steps.
What is the stopping time?
The number of steps until the sequence first drops below its starting value. The total stopping time is the number of steps to reach 1.
What is the shortcut form?
An odd n goes straight to (3n + 1)/2, combining two steps. It gives shorter step counts.
Sources
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.