Collatz Sequence Calculator Online Free
Collatz Sequence Calculator
Follow the Collatz rule from any starting number and see the full sequence, the step count, and the highest value reached — free, in your browser, nothing uploaded. The rule is simple: halve an even number, triple an odd number and add one, and repeat until you reach 1.
Take any positive whole number. If it is even, halve it. If it is odd, triple it and add one. Repeat. However large or complicated the number you start with, you will, apparently, always reach 1, and from 1 you go to 4, then 2, then 1 again, in a little loop. That is the Collatz conjecture, also called the 3n + 1 problem, and it is one of the most famous unsolved problems in mathematics: a rule a child can follow, a claim that has been checked for numbers with hundreds of digits, and no proof that it holds for every number. The Collatz sequence calculator at the top of this page follows the rule from any starting number you choose, shows the full sequence, counts the steps, and reports the highest value reached, so you can explore the conjecture yourself instead of merely reading about it.
The fascination of the problem is the contrast between the simplicity of the rule and the wildness of the sequences it produces. Start with 6 and you get a short, tidy descent: 6, 3, 10, 5, 16, 8, 4, 2, 1, in eight steps. Start with 27, a number only a little larger, and you get a sequence of 112 numbers that climbs to 9232, wanders for 111 steps, and only then falls to 1. Start with 97 and you climb to 9232 as well, by a different route. Start with 871 and you climb above one hundred and ninety thousand before falling. There is no obvious pattern in which starting numbers climb high and which fall quickly, and that unpredictability, from a rule with only two cases, is why the problem has resisted proof for nearly ninety years despite being checked, by computer, for every starting number up to astronomically large bounds.
What It Is
The Collatz function is defined on positive integers as follows: if n is even, the next number is n/2; if n is odd, the next number is 3n + 1. Applying the function repeatedly generates the Collatz sequence, also called a hailstone sequence, because like hailstones in a storm cloud, the numbers rise and fall repeatedly before finally coming down. The conjecture, proposed by Lothar Collatz in 1937, is that every starting number eventually reaches 1, and therefore eventually enters the loop 4, 2, 1, 4, 2, 1, which is the only loop known. The calculator counts steps as moves, not as numbers listed: starting from 27 gives 111 steps and 112 numbers, because the starting 27 is listed but is not a move, and the final 1 is reached after 111 applications of the rule. That distinction is stated in the tool’s note, because step counts in books and videos sometimes differ by one depending on whether the starting number or the final 1 is counted, and naming the convention prevents confusion when you compare results.
Two derived quantities are reported alongside the sequence, and both are worth understanding. The stopping time, or total stopping time, is the number of steps to reach 1, which is 111 for 27 and 8 for 6. The maximum value, sometimes called the peak, is the largest number reached along the way, which is 9232 for 27 and 16 for 6. These two quantities measure different aspects of a sequence: a sequence can be long without climbing very high, and a sequence can climb very high without being very long, though in practice the two are correlated, because climbing high usually takes many steps to come back down. The calculator reports both, so you can compare starting numbers on either measure, and the article below gives examples that show how the two measures diverge.
How to Use the Calculator
Using the tool takes less than a minute. Follow these steps:
- Enter a positive whole number as the starting number, for example 27. Whole numbers up to 1,000,000 are accepted.
- Press “Show Collatz Sequence”. The tool shows the step count, the maximum value, and the total number of numbers in the sequence, followed by the sequence itself.
- Read the sequence from left to right: each number is obtained from the previous one by halving, if even, or by tripling and adding one, if odd.
- Compare starting numbers by trying neighbours: 26, 27, and 28 give strikingly different sequences, which is itself a lesson in the problem’s sensitivity.
- If a sequence is very long, the tool shows the first one hundred numbers, then a note of how many are in the middle, then the last twenty numbers, so the beginning and the end are always visible.
A few habits will save you confusion. Count steps as moves, as the tool does, when comparing with other sources, and check whether a source counts the starting number, which would add one to the count. Remember that the sequence always ends at 1 in the tool’s display, because the tool stops when it reaches 1; it does not continue into the 4, 2, 1 loop, which would be repetitive and uninformative. And remember that a large maximum does not mean the sequence is stuck: the Collatz rule can climb steeply, because tripling an odd number roughly triples it, while halving only halves it, so a run of odd numbers can multiply a value several times over before an even number brings it back down.
Worked Examples
Example 1: Starting from 27, the live test
This is the test used to check the tool, and it is the classic example of Collatz wildness. Starting from 27, the sequence begins 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, and continues, climbing and falling, until it reaches 9232, its maximum, and then falls, through 4616, 2308, 1154, 577, and a long descent, to 1. The full sequence has 112 numbers and takes 111 steps. The calculator returns exactly those figures: 111 steps, maximum 9232, 112 numbers. The reason 27 is famous is that it is the smallest starting number whose sequence climbs above nine thousand, and the smallest whose stopping time exceeds one hundred, which makes it a compact demonstration that a small input can produce a large and long output. It is also a good test of any Collatz implementation, because a program that mishandles the odd case, or that counts steps incorrectly, will give a different answer for 27, while a correct program gives 111 and 9232 without exception.
Example 2: Starting from 6, the tidy descent
Starting from 6, the sequence is 6, 3, 10, 5, 16, 8, 4, 2, 1: eight steps, maximum 16, nine numbers. The calculator returns 8 steps and maximum 16. This example is useful as a sanity check and as a contrast with 27: here the odd step from 3 to 10 is followed immediately by halving, so the climb is brief, and the sequence falls smoothly thereafter. Powers of two behave even more tidily: starting from 16 gives 16, 8, 4, 2, 1, in four steps, with maximum 16, because no odd step ever occurs. Starting from a number one less than a power of two, by contrast, often gives a long climb, because the first odd step triples a large number and the result is even, so it is halved, but the net effect over several odd steps can still be growth. That contrast, between powers of two and numbers just below them, is one of the first patterns a Collatz explorer notices.
Example 3: Starting from 97, the same peak by another route
Starting from 97, the sequence climbs to 9232 as well, the same maximum as 27, but by a different route and with a different stopping time, 118 steps. The calculator returns 118 steps and maximum 9232 for 97. The shared maximum is not a coincidence: many starting numbers eventually merge into the same tail of a sequence, because once two sequences hit the same number, they follow the same path thereafter, since the rule is deterministic. The number 9232 is on the tail of 27’s sequence, and 97’s sequence reaches it too, after its own wanderings, and from there the two sequences coincide. This merging property is why Collatz sequences form a kind of tree, with branches joining as they descend towards 1, and it is why the total number of distinct sequences is far smaller than the number of starting numbers. It also explains why checking the conjecture up to a bound is easier than it sounds: once a sequence drops below its starting number, the rest of its journey has already been checked, if all smaller numbers have been checked.
Example 4: Starting from 871, a high climb
Starting from 871, the sequence climbs to 190,996 before falling to 1, in 178 steps. The calculator returns 178 steps and maximum 190,996 for 871. This example shows that the peak can be more than two hundred times the starting number, which surprises people who expect a sequence to stay near its starting value. The climb happens because 871 is odd, so it goes to 2614, which is even, so it halves to 1307, which is odd, so it goes to 3922, and so on, with odd steps outnumbering the halving steps in the early phase, so the value grows. Eventually the even steps catch up, because every odd step produces an even number, which is then halved, so the average growth per pair of steps is a factor of about three halves, and a run of such pairs can multiply the value substantially before the sequence turns down. The eventual fall is guaranteed, in every case checked, by the fact that sufficiently many halvings will overcome any finite climb, but the proof that it always happens, for every starting number, is exactly what is missing.
Why It Is Hard: The Conjecture and Its Status
The Collatz conjecture has been checked, by computer, for starting numbers up to at least 2^68, a number with twenty-one digits, and no counterexample has been found: no starting number that grows forever, and no loop other than 4, 2, 1, has ever been observed. That is strong evidence, but it is not a proof, and mathematicians are careful to distinguish the two. A proof would need to show, for an arbitrary starting number, that the sequence must eventually fall, and the difficulty is that the rule mixes multiplication by three and division by two in a way that depends on the binary representation of the numbers involved, in a pattern that has resisted all standard techniques. The problem is sometimes called a “siren” problem, because it is so easy to state that it lures mathematicians into spending years on it, and Paul Erdős famously remarked that mathematics is not yet ready for such problems. That remark is worth quoting in spirit, because it captures the status honestly: the conjecture is almost certainly true, given the computational evidence, but “almost certainly” is not a theorem, and the gap between evidence and proof is the whole problem.
Partial results exist, and they are worth knowing so the conjecture is not presented as wholly untouched. It is known that almost all numbers, in a precise density sense, eventually reach a value smaller than themselves, which means that most numbers can be handled by induction on smaller numbers, though “almost all” still leaves infinitely many numbers unaccounted for. It is known that any non-trivial loop, if one existed, would have to be enormously long, with a minimum length in the billions, which rules out small loops by computation. And it is known that the stopping time grows, on average, only logarithmically with the starting number, so typical sequences are short even though exceptional ones, like 27, are long. None of these results closes the gap, and that is why the calculator is presented as an exploration tool, not as a proof assistant: it lets you see the phenomenon, and it states plainly that the phenomenon is unproved.
The Tree, the Merging, and a Useful Way to Explore
A fruitful way to explore Collatz sequences is backwards: start from 1 and ask which numbers could have come before it. The predecessors of an even number n are 2n, always, and, when n − 1 is divisible by three and the result is odd, (n − 1)/3 as well. Building that tree backwards generates every number that reaches 1, if the conjecture is true, and it reveals the branching structure that forward exploration hides. The calculator works forwards, from a starting number to 1, but you can use it backwards in spirit by trying numbers that you suspect might merge: try 27 and 97, and notice that they share a tail, or try a number and the number that precedes it in its own sequence, and notice that the predecessor’s sequence is exactly the successor’s sequence with one extra number at the front. That kind of experiment, repeated, builds an intuition for why the conjecture might be true, even though it does not prove it, and it is the kind of intuition that computational exploration is good for.
Another useful exploration is to tabulate stopping times for a range of starting numbers and look for records: the smallest starting number with a given stopping time, or the starting number below one hundred with the longest sequence, which is 97, or below one thousand, which is 871, with 178 steps. Record-holders are interesting because they show where the worst cases lie, and because they are often numbers one less than a power of two, or numbers with many odd steps early on. The calculator, used one starting number at a time, lets you verify any record claim you read, and verifying a claim yourself is more valuable than merely reading it, because it turns a piece of trivia into a piece of understanding.
Limits: What This Tool Does and Does Not Do
This tool follows the Collatz rule from a positive whole number up to 1,000,000, counts steps as moves, reports the maximum value, and shows the full sequence, truncated in the middle for very long sequences so the beginning and end remain visible. It stops after 10,000 steps or if a value exceeds the safe integer range, rather than looping forever or returning a wrong answer from floating-point overflow, and it reports that stop plainly if it happens. It does not prove the conjecture, does not search for counterexamples, and does not handle non-integers, negative numbers, or zero, because the Collatz rule as usually stated is defined on positive integers, and extending it to other numbers changes the problem. It also does not continue past 1 into the 4, 2, 1 loop, because that loop is repetitive and adds no information. Within those limits, its arithmetic is exact integer arithmetic for the range it accepts, and the live test, 27 giving 111 steps and maximum 9232, lets you verify its correctness immediately.
Privacy: Your Numbers Stay in Your Browser
Every number you enter into this Collatz sequence calculator stays in your browser. Nothing is uploaded to a server, nothing is stored, and there is no account to create. The calculation runs entirely on your own device. That matters even for a mathematics tool, because the numbers people enter can be part of coursework, an exam revision session, or a piece of unpublished work, and that work deserves to stay private. Closing the page removes your inputs, and no one else sees them. This browser-only design is the same principle behind the other free tools on Your Smart Kit: a simple tool that does one job well, keeps your data private, and gives an answer you can check.
Frequently Asked Questions
What is the Collatz conjecture?
It is the claim that starting from any positive whole number, repeatedly halving evens and replacing odds by three times the number plus one, always reaches 1. It has been checked for astronomically large numbers but has never been proved, so it remains a conjecture, not a theorem.
Why does the calculator count 111 steps for 27, not 112?
Because steps count moves, not numbers listed. The sequence from 27 has 112 numbers, including the starting 27 and the final 1, but only 111 moves between them. Some sources count differently, so check the convention before comparing step counts.
What is the maximum value for 27?
The maximum, or peak, is 9232, reached partway through the sequence, long before it falls to 1. The peak and the step count measure different things: a sequence can climb high without being the longest, and vice versa.
Has anyone found a number that does not reach 1?
No. No counterexample has ever been found, and no loop other than 4, 2, 1 has ever been observed, despite checking starting numbers up to at least 2^68. That is strong evidence, but evidence is not proof, and the conjecture remains open.
Why do some small numbers give such long sequences?
Because the rule is sensitive to the binary pattern of the number. A run of odd steps can multiply a value several times over before halving brings it back down, so a starting number like 27, with many early odd steps, climbs to 9232 and takes 111 steps, while a neighbour like 28 falls quickly. There is no simple rule predicting which starting numbers will be long.
Can I use this for very large starting numbers?
The tool accepts starting numbers up to 1,000,000, which covers every number a human is likely to explore by hand, and it stops safely if a sequence exceeds 10,000 steps or the safe integer range. For larger numbers, a specialised program with arbitrary-precision integers would be needed.
Related Tools on Your Smart Kit
If you found the Collatz sequence calculator useful, you may also like the other free calculators on Your Smart Kit, including the infinite series calculator for adding terms one by one, the sigma calculator for summing a finite list of terms, and the arithmetic sequence calculator for sequences that march by a fixed step. Each runs in your browser, free, with no sign-up, and each is built on the same principle: a simple tool that does one job well, keeps your data private, and gives an answer you can check. Try the Collatz sequence calculator at the top of this page with your own starting number, and see whether a rule a child can follow really does always lead back to 1.
