Skip to main content

Collatz Conjecture Calculator

Free Collatz conjecture Calculator for sequences. Enter values to get step-by-step solutions with formulas and graphs. Get results you can export or share.

Share this calculator

Formula

If n is even: n -> n/2 | If n is odd: n -> 3n + 1

Starting from any positive integer, repeatedly apply these two rules. The Collatz conjecture states that this process will always eventually reach 1, regardless of the starting number. The sequence of values is also called hailstone numbers because they rise and fall like hailstones in a cloud.

Worked Examples

Example 1: Classic Example: Starting at 27

Problem: Compute the Collatz sequence starting at 27. How many steps does it take to reach 1, and what is the maximum value?

Solution: Starting at 27:\n27 -> 82 -> 41 -> 124 -> 62 -> 31 -> 94 -> 47 -> 142 -> 71 -> ...\nThe sequence climbs to a peak of 9,232 at step 77\nAfter the peak, it descends through powers of 2\nThe sequence finally reaches 1 after 111 steps\nTotal odd steps: 41 | Total even steps: 70

Result: Stopping time: 111 steps | Peak value: 9,232 | Peak/Start ratio: 341.93x

Example 2: Power of 2: Starting at 64

Problem: Compute the Collatz sequence starting at 64 (which is 2^6).

Solution: Starting at 64:\n64 -> 32 -> 16 -> 8 -> 4 -> 2 -> 1\nSince 64 = 2^6, the sequence simply halves 6 times\nAll steps are even-number divisions\nNo odd steps occur, so the value never increases\nThis is the shortest possible sequence for a number of this magnitude

Result: Stopping time: 6 steps | Peak value: 64 | All 6 steps are even divisions

Frequently Asked Questions

What is the Collatz conjecture and why is it famous?

The Collatz conjecture, also known as the 3n+1 problem, is one of the most famous unsolved problems in mathematics. The rule is simple: start with any positive integer, if it is even divide by 2, if it is odd multiply by 3 and add 1. The conjecture states that no matter what starting number you choose, the sequence will always eventually reach 1. Despite its simple formulation, no one has been able to prove this is true for all numbers, even after decades of effort by brilliant mathematicians. Paul Erdos famously said that mathematics is not yet ready for such problems.

How does the Collatz sequence work step by step?

Starting with any positive integer n, apply two rules repeatedly. Rule 1: if n is even, divide it by 2 (n becomes n/2). Rule 2: if n is odd, multiply by 3 and add 1 (n becomes 3n+1). Continue until you reach 1. For example, starting with 6: 6 is even, so 6/2=3. Then 3 is odd, so 3x3+1=10. Then 10/2=5, 5x3+1=16, 16/2=8, 8/2=4, 4/2=2, 2/2=1. The sequence is 6, 3, 10, 5, 16, 8, 4, 2, 1, taking 8 steps. The path can be surprisingly long and unpredictable even for small starting numbers.

What is the stopping time in the Collatz sequence?

The stopping time (also called total stopping time) is the number of steps required for the sequence to reach 1 from the starting number. Different starting values produce vastly different stopping times. The number 1 has a stopping time of 0. The number 2 takes 1 step. The number 27 is famous because despite being relatively small, it takes 111 steps and reaches a maximum value of 9,232 before finally descending to 1. There is no known formula to predict the stopping time without actually computing the sequence. This unpredictability is part of what makes the conjecture so challenging to prove.

What are some notable numbers in Collatz sequences?

The number 27 is perhaps the most famous example because it takes 111 steps and climbs to 9,232 before reaching 1, demonstrating how a small starting number can produce a long, wild trajectory. Powers of 2 have the shortest sequences since they simply halve down to 1 (for example, 64 takes only 6 steps). The number 9,663 takes 184 steps. Among the first million numbers, 837,799 has the longest sequence at 524 steps. The number 77,031 reaches a peak value over 21 million. These examples illustrate the chaotic and unpredictable nature of the sequences generated by this deceptively simple rule.

Has the Collatz conjecture been verified by computers?

Yes, computers have verified the Collatz conjecture for all starting numbers up to approximately 2.95 x 10 to the 20th power (as of recent computations). This means every number tested so far does eventually reach 1. However, computational verification, no matter how extensive, cannot constitute a mathematical proof because there are infinitely many positive integers. It remains possible, though increasingly unlikely, that some extremely large number could form an infinite loop or diverge to infinity. The computational evidence strongly supports the conjecture, but mathematics requires absolute proof for certainty.

What mathematical approaches have been tried to prove the Collatz conjecture?

Mathematicians have attacked the Collatz conjecture from many angles without success. Terrence Tao proved in 2019 that almost all Collatz orbits attain almost bounded values, the strongest result to date. Other approaches include ergodic theory, which studies statistical properties of the iterative mapping. Algebraic approaches examine the problem in different number systems like p-adic numbers. Graph theory approaches model the sequence as a directed graph. Some researchers have studied generalizations like 5n+1 or other variants to understand the broader class of such problems. The conjecture resists all these methods, suggesting a fundamentally new technique may be required.

References