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.
Calculator
Adjust values & calculateSequence (first 100 values)
Formula
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.
Last reviewed: December 2025
Worked Examples
Example 1: Classic Example: Starting at 27
Example 2: Power of 2: Starting at 64
Background & Theory
The Collatz Conjecture Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.
History
The history behind the Collatz Conjecture Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.
Frequently Asked Questions
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
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy