๐ข Collatz Calculator: Generate the 3n+1 Sequence, Steps and Peak
By Shihab Mia ยท Updated 2026-07-01
Enter a positive whole number to build its Collatz sequence.
A Collatz calculator takes any positive whole number and follows the famous 3n+1 rule until it lands on 1: if the current number is even, halve it; if it is odd, multiply by 3 and add 1. Enter a starting value and this tool instantly returns the full hailstone sequence, the number of steps needed to reach 1 (the total stopping time), the highest value the sequence climbs to (the peak), and how many of the steps were halvings versus 3n+1 jumps. It does the tedious bookkeeping so you can focus on the pattern.
What is the Collatz Conjecture Calculator?
The Collatz conjecture, also called the 3n+1 problem, the 3x+1 problem, the Ulam conjecture, Kakutani's problem, or the hailstone problem, is one of the most famous unsolved questions in mathematics. It was introduced by the German mathematician Lothar Collatz in 1937. Starting from any positive integer, you repeatedly apply a single rule: if the number is even, divide it by 2; if it is odd, replace it with 3 times the number plus 1. The conjecture claims that no matter which positive integer you start with, the sequence always eventually reaches 1, after which it loops through 4, 2, 1 forever. Despite being simple enough to explain to a child, no one has ever proved it true for every number, nor found a single counterexample.
The values along the way are nicknamed hailstone numbers because, like hailstones tossed up and down inside a storm cloud, they rise and fall many times before finally dropping to the ground (to 1). Some starting numbers settle quickly while others take a wild ride, and there is no obvious pattern linking a number to how long its journey lasts. The number 26 reaches 1 in only 10 steps, its neighbour 27 takes a dramatic 111 steps and climbs to a peak of 9232 (more than 341 times where it started), and 28 takes just 18 steps. This chaotic sensitivity is exactly what makes the problem so captivating.
Two quantities describe each sequence. The total stopping time is the number of times the rule is applied before the value first reaches 1. The peak (or maximum trajectory value) is the highest number the sequence touches on its way down. Because every odd step (3n+1) always produces an even number, mathematicians often use a shortcut, or accelerated, Collatz map that folds each 3n+1 step together with the halving that must follow it, turning odd n directly into (3n+1)/2. The shortcut map reaches 1 in fewer steps but describes the same underlying journey, which is why different sources sometimes report slightly different step counts for the same starting number.
Mathematicians have verified the conjecture by computer for every starting value up to roughly 2.95 times 10 to the 20th power (about 2 to the 68th power), an astronomically large range, and every single one reaches 1. That is powerful evidence, but it is verification, not proof: a conjecture is only settled when it is proved for all numbers or disproved by one counterexample. The strongest theoretical progress came in 2019, when Fields Medalist Terence Tao proved that almost all Collatz starting values eventually reach a value smaller than any function that grows to infinity, a result that comes remarkably close to the full conjecture without closing it.
The problem has attracted legendary names and legendary caution. Paul Erdos said of it, "Mathematics may not be ready for such questions," and offered a cash prize for a solution. The difficulty is that the 3n+1 dynamics behave almost like a random walk, resisting the usual tools of number theory. That mix of childlike simplicity and deep intractability is precisely why letting a calculator generate individual sequences is such a satisfying way to build intuition for a problem the experts still cannot crack.
When to use it
- Exploring the 3n+1 problem for a class, a homework assignment, or pure curiosity.
- Checking the total stopping time (number of steps) and peak value for a specific starting number without hand computation.
- Comparing how neighbouring numbers behave, for example how 26 settles in 10 steps while 27 explodes to 111.
- Generating the full hailstone sequence to plot, animate, or paste into a report or spreadsheet.
- Demonstrating a famous unsolved mathematics problem in a way students can run and re-run themselves.
- Checking the parity split (how many even halvings versus odd 3n+1 jumps) to study the structure of a trajectory.
How to use the Collatz Conjecture Calculator
- Enter a positive whole number (1 or greater) as the starting value.
- The calculator applies the Collatz rule: even numbers are halved, odd numbers become 3n+1.
- Read off the number of steps to reach 1, the highest value reached, and the even/odd step counts.
- View or copy the full sequence shown below the summary cards to reuse elsewhere.
Formula & method
Worked examples
Start the sequence at 6.
- 6 is even, so 6 / 2 = 3
- 3 is odd, so 3 x 3 + 1 = 10
- 10 is even, so 10 / 2 = 5
- 5 is odd, so 5 x 3 + 1 = 16
- 16 to 8 to 4 to 2 to 1 (four more halvings)
- Sequence: 6, 3, 10, 5, 16, 8, 4, 2, 1
Result: 8 steps to reach 1, highest value 16
Start the sequence at 7.
- 7 is odd, so 7 x 3 + 1 = 22
- 22 to 11 to 34 to 17 to 52 to 26 to 13 to 40 to 20 to 10 to 5 to 16 to 8 to 4 to 2 to 1
- The full sequence has 17 terms
- The highest value reached along the way is 52
Result: 16 steps to reach 1, highest value 52
Start the sequence at 27 (the famous wild one).
- 27 is odd, so 27 x 3 + 1 = 82, then 82 / 2 = 41
- The value keeps climbing and falling, passing through numbers in the thousands
- It reaches a maximum of 9232 partway through, over 341 times the starting value
- From there it eventually descends through 16, 8, 4, 2, 1
Result: 111 steps to reach 1, highest value 9232
Collatz stopping time and peak value for small starting numbers
| Start | Steps to reach 1 | Highest value (peak) |
|---|---|---|
| 1 | 0 | 1 |
| 2 | 1 | 2 |
| 6 | 8 | 16 |
| 7 | 16 | 52 |
| 9 | 19 | 52 |
| 26 | 10 | 40 |
| 27 | 111 | 9232 |
| 28 | 18 | 52 |
| 97 | 118 | 9232 |
| 703 | 170 | 250504 |
Record holders: smallest starting number needing more steps than any smaller one
| Start | Total stopping time (steps) |
|---|---|
| 1 | 0 |
| 2 | 1 |
| 3 | 7 |
| 6 | 8 |
| 7 | 16 |
| 9 | 19 |
| 18 | 20 |
| 25 | 23 |
| 27 | 111 |
| 54 | 112 |
| 73 | 115 |
| 97 | 118 |
Common mistakes to avoid
- Counting the starting number as a step. The number of steps is how many times the rule is applied to reach 1, not how many numbers are in the list. Starting at 6 gives a 9-term sequence but takes 8 steps, because the first term is the start itself.
- Thinking the conjecture has been proved. It has been checked by computer for every starting value into the hundreds of quintillions, but that is verification, not proof. The Collatz conjecture remains formally unproven for all positive integers.
- Expecting the sequence to only go down. Odd numbers trigger the 3n+1 rule, which makes the value jump up, often far above the start. The values rise and fall many times (hence hailstone numbers) before finally reaching 1.
- Confusing the standard map with the shortcut map. The accelerated Collatz map combines each odd 3n+1 step with the halving that always follows, using (3n+1)/2. It reaches 1 in fewer counted steps, so step totals can differ between tools depending on which map they use.
- Starting from 0 or a negative number. The conjecture is stated for positive integers. Zero stays at zero, and negative numbers fall into different cycles, so a Collatz calculator only accepts whole numbers of 1 or more.
- Assuming a bigger start means more steps. There is no such rule. 26 reaches 1 in 10 steps while its neighbour 27 needs 111, and many large numbers finish faster than small ones. Stopping time is famously erratic.
Glossary
- Collatz conjecture
- The claim that repeatedly applying the 3n+1 rule to any positive integer eventually reaches 1.
- 3n+1 rule
- The transformation: if n is even use n / 2, and if n is odd use 3n + 1.
- Total stopping time
- The number of times the rule must be applied before the sequence first reaches 1.
- Stopping time
- The number of steps needed to first reach a value smaller than the starting number.
- Hailstone numbers
- The values in a Collatz sequence, named because they rise and fall many times like hailstones before settling.
- Peak
- The highest value the sequence reaches before descending to 1, also called the maximum trajectory value.
- Shortcut (accelerated) map
- A version of the rule that folds each odd 3n+1 step together with its following halving, using (3n+1)/2.
- Trivial cycle
- The endless 4, 2, 1 loop that every sequence enters once it reaches 1.
Frequently asked questions
What is the Collatz conjecture?
The Collatz conjecture, also called the 3n+1 problem, says that if you start with any positive whole number and repeatedly halve it when even and replace it with 3n+1 when odd, you will always eventually reach 1. It is simple to state but has never been proved or disproved.
How do you calculate a Collatz sequence?
Start with your number. If it is even, divide by 2. If it is odd, multiply by 3 and add 1. Repeat this on each new result and keep going until you reach 1. The list of values you pass through is the Collatz sequence. This calculator does every step for you and reports the totals.
What is the total stopping time?
The total stopping time is the number of times the rule is applied before the sequence first reaches 1. For example, starting at 6 the total stopping time is 8, and starting at 27 it is 111. It is the single most common thing people measure about a Collatz sequence.
Why is 27 a famous Collatz starting number?
Although 27 is small, its sequence is surprisingly long and wild: it takes 111 steps to reach 1 and climbs all the way up to a peak of 9232, more than 341 times its starting value, before coming back down. It is a popular example because it shows how unpredictable the sequence can be.
Has the Collatz conjecture been solved?
No. It remains an open problem. Computers have confirmed that every starting value up to roughly 2.95 times 10 to the 20th power (about 2 to the 68th power) reaches 1, but that is not a proof for all numbers, and no counterexample has ever been found.
What did Terence Tao prove about the Collatz conjecture?
In 2019, Fields Medalist Terence Tao proved that almost all Collatz starting values eventually fall below any function that grows to infinity. In plain terms, almost every number gets very small at some point. It is the strongest partial result to date but still does not prove the full conjecture.
What are hailstone numbers?
Hailstone numbers are the values that appear in a Collatz sequence. They get the name because, like hailstones tossed up and down inside a storm cloud, they rise and fall many times before finally dropping to 1.
Does every number reach 1?
That is exactly what the conjecture claims, and every number ever tested does reach 1. However, no one has proved it must hold for absolutely every positive integer, so strictly speaking it is still unproven.
Why do some tools report different step counts for the same number?
Because there are two common versions of the rule. The standard map counts each halving and each 3n+1 as a separate step, while the shortcut (accelerated) map combines each 3n+1 with the halving that follows it, so it reaches 1 in fewer counted steps. Both describe the same journey.
What happens after the sequence reaches 1?
Once you reach 1, the rule gives 1 to 4 to 2 to 1, which repeats forever. This 4, 2, 1 loop is called the trivial cycle, and by convention the sequence is considered finished the moment it first hits 1.