Collatz Conjecture Calculator - 3n+1 Hailstone Sequence Tool

Use the Collatz conjecture calculator to build the 3n+1 hailstone sequence from any starting integer, with stopping time, total stopping time, and peak value.

Updated: June 16, 2026 • Free Tool

Collatz Conjecture Calculator

Any integer from -1,000,000 to 1,000,000. Use 27 to see the classic long Collatz example.

Maximum number of iterations to perform. The Collatz iteration can be long, so the page stops at this cap to stay responsive.

Results

Total stopping time (steps to first reach 1)
0
Stopping time (steps to first drop below x₁) 0
Peak value (largest term reached) 0
Sequence length (total terms generated) 0
Iteration status 0
Sequence preview (first 25 + last 3 terms) 0

What Is Collatz Conjecture Calculator?

A Collatz conjecture calculator builds the famous 3n+1 (hailstone) sequence from any positive integer and reports how many steps it takes to reach 1. Type a starting value such as 27, set a step cap, and the calculator prints the full sequence plus the stopping time, total stopping time, peak value, and iteration status.

  • Explore the 3n+1 problem: Pick any positive integer and watch how the parity rules send it on a wild ride before collapsing to 1.
  • Reproduce the classic x1 = 27 example: Confirm the textbook peak of 9232 in 111 steps, the most cited non-trivial Collatz sequence.
  • Check small starting values fast: Type 1, 2, 4, 6, or 16 to see powers of two, small odd numbers, and the 1 -> 4 -> 2 -> 1 cycle.
  • Try the negative-integer generalized map: Negative inputs follow the same 3n+1 rule and land in one of the three known loops at -1, -5, or -17.

The Collatz conjecture is the unsolved number theory problem that asks whether the simple parity rule always reaches 1 for any positive starting integer. Every value tested so far does, but no one has been able to prove the rule for every integer.

For a sequence that always moves by a fixed step instead of jumping by a parity rule, the Arithmetic Sequence Calculator builds the same n-th term, sum, and term list from a first term and a common difference.

How Collatz Conjecture Calculator Works

The Collatz conjecture calculator applies the parity rule iteratively, one step at a time, until it reaches 1, hits the step cap, or enters a previously seen value. The total stopping time counts steps before the first 1, the stopping time counts steps before the trajectory first drops below the starting value, and the peak value is the largest term reached.

x_{n+1} = x_n / 2 if x_n is even; x_{n+1} = 3 x_n + 1 if x_n is odd
  • x₁: Starting integer. Any non-zero integer from -1,000,000 to 1,000,000.
  • step cap: Maximum iterations. Default 1000, so the page stays responsive on long sequences.
  • total stopping time: Steps until the sequence first reaches 1. The value most Collatz references call 'stopping time'. 0 if x₁ is already 1.
  • stopping time: Steps until the sequence first produces a value strictly smaller than x₁. For x₁ = 27 the stopping time is 96 (first drops to 23).
  • peak value: Largest term reached. For x₁ = 27 the peak is 9232.

The Collatz iteration has been tested for starting values up to almost 3 × 10^20 and every one has reached 1, but no one has been able to prove the rule for every integer.

Starting at 6 (the short classic example)

x₁ = 6, step cap = 1000

6 (even -> 3) -> 3 (odd -> 10) -> 10 (even -> 5) -> 5 (odd -> 16) -> 8 -> 4 -> 2 -> 1

stopping time = 1; total stopping time = 8; peak = 16

Standard teaching example for the Collatz rule.

Starting at 27 (the long classic example)

x₁ = 27, step cap = 1000

Climbs to 9232 over 77 steps, then descends in 34 more to 1.

stopping time = 96 (first value below 27 is 23); total stopping time = 111; peak value = 9232

The most cited non-trivial Collatz example, with a peak 342 times the starting value.

According to Wikipedia (Collatz conjecture), the Collatz conjecture states that starting from any positive integer and repeatedly applying x_{n+1} = x_n / 2 if x_n is even and x_{n+1} = 3 x_n + 1 if x_n is odd, the sequence always reaches 1 before falling into the cycle 1, 4, 2, 1

According to Wolfram MathWorld, the Collatz sequence starting at 27 reaches a peak value of 9232 before descending to 1, and the sequence length from 27 to 1 is 111 steps

The parity check inside the Collatz rule is the same modulus-2 test you would run in the Modulo Calculator, so you can use that tool to confirm whether the current term is even or odd before you step the sequence by hand.

Key Concepts Explained

These four ideas are enough to read every row the Collatz conjecture calculator prints and to know when to trust a result.

Parity rule

The Collatz map uses only the parity of the current term. Even means divide by 2; odd means multiply by 3 and add 1. The two rules are why the sequence is also called the 3n+1 problem.

Hailstone sequence

The Collatz sequence is called a hailstone sequence because the values swing up and down like a hailstone in a cloud before falling to 1. The peak value is the highest point in that swing.

Stopping time vs total stopping time

The total stopping time is the steps to first reach 1; this is the value Collatz references call 'stopping time'. The stopping time is the steps until the sequence first drops below x₁. For x₁ = 27 the stopping time is 96 and the total stopping time is 111.

Known negative-integer loops

For negative starting values, the generalized 3x+1 map falls into one of three cycles at -1, -5, and -17. The calculator surfaces the matched loop name.

The parity rule is the only place where the Collatz sequence depends on number theory. Once you know whether the current value is even or odd, the next term is a single arithmetic step.

The hailstone naming is descriptive: a trajectory for inputs like 27 looks like a hailstone in a cloud, swinging up and down through peaks like 9232 before falling to 1. Most starting values are composite, so the peak term for inputs like x1 = 27 includes prime factors worth factoring, which the Prime Number Checker handles in one pass.

How to Use This Calculator

Six short steps cover everything from a quick homework check to a long exploration of the negative-integer generalized map.

  1. 1 Type a starting value: Enter x₁, the integer to start the sequence from. Use 27 for the classic long example, 1 for the trivial cycle, or a negative integer for the generalized map.
  2. 2 Type a step cap: Enter the maximum iterations the calculator performs. Default is 1000, which covers the 27-to-1 case and most small inputs.
  3. 3 Read the total stopping time: The total stopping time row tells you how many iterations it takes to first reach 1. This is the headline number most Collatz references report. A value of 0 means x₁ was already 1.
  4. 4 Read the stopping time: The stopping time counts the steps until the trajectory first drops below x₁. For x₁ = 27 the stopping time is 96 (first value below 27 is 23); total stopping time to reach 1 is 111.
  5. 5 Read the peak value: The peak value row is the largest term the iteration ever reaches. For x₁ = 27 the peak is 9232.
  6. 6 Scan the sequence preview: The preview shows the first 25 terms and the last 3 terms, separated by an ellipsis. Use it to confirm the parity rule is being applied the way you expect.

Set x₁ = 27, step cap = 1000. Total stopping time reads 111, stopping time reads 96, peak value reads 9232; preview starts 27, 82, 41, 124, 62, 31, ... and ends ..., 4, 2, 1.

When the peak value for a large starting value is hard to read at full precision, the Rounding Calculator lets you report it to a chosen number of significant figures or to the nearest power of ten in a single step.

Benefits of Using This Calculator

The Collatz conjecture calculator removes the need to re-implement the parity rule, to count the steps by hand, or to copy a long list out of a textbook.

  • Full sequence in one pass: Builds the complete 3n+1 sequence from x₁ in a single pass, so you do not have to re-enter the same starting value into a separate tool.
  • Three summary numbers, not just the list: Total stopping time, stopping time, and peak value print at the same time, the part of the problem that is the most tedious to do by hand.
  • Step cap keeps the page responsive: The iteration can be very long, so the calculator caps the number of iterations and tells you when the cap is hit. The default cap of 1000 covers the 27-to-1 case.
  • Negative-integer generalized map supported: Negative starting values use the same 3x+1 rule, and the calculator recognizes the three known cycles at -1, -5, and -17.
  • Pairs with related number-theory tools: The parity check is the same modulus-2 test used in a modulo calculator, and the peak value is the largest term in the sequence.

The calculator is just JavaScript in the browser, so it updates as you type and tolerates large starting values as long as the step cap is high enough.

When you want to express the peak-to-starting-value ratio of a Collatz sequence (such as 9232/27 for x1 = 27) as a clean numeric ratio, the Ratio Calculator returns the simplified form in a single step.

Factors That Affect Your Results

Three things change the answer you should expect, plus two practical caveats about how the Collatz iteration behaves for unusual inputs.

Starting value x₁

Small powers of two (1, 2, 4, 8, 16, ...) collapse to 1 in log₂(x₁) steps with no peaks. The classic long example is x₁ = 27, which reaches a peak of 9232 in 111 steps and first drops below 27 at step 96.

Sign of x₁ (positive vs negative)

Positive starting values are conjectured to always reach 1. Negative starting values follow the same parity rule but land in one of three known cycles at -1, -5, and -17, so the total stopping time is left blank for those inputs.

Step cap

Some Collatz sequences are very long. The default cap of 1000 is enough for x₁ ≤ 27; raise the cap for a starting value with a longer known total stopping time.

Floating-point and integer overflow

The Collatz iteration can produce very large values (e.g., 9232 for x₁ = 27, millions for larger x₁). The calculator stays exact up to about 2^53.

  • The Collatz conjecture is unproven. The calculator will report that the sequence reached 1 for any positive starting value, but the conjecture is still open in number theory.
  • The step cap is a safety net, not a mathematical statement. If the iteration hits the cap before reaching 1, the stopping time and peak value are reported as 'hit step cap'.

If the iteration status reads 'loop (-5 cycle)' or similar, the starting value was negative and the iteration entered one of the three known cycles for the generalized 3x+1 map.

According to MacTutor History of Mathematics (Lothar Collatz biography), the Collatz conjecture is the unsolved number theory problem also known as the 3n+1 problem, posed by Lothar Collatz in the 1930s and still open today

If you want to fit a log-log line through the stopping time of several Collatz starting values to see how the steps grow with the input, the Linear Regression Calculator gives the slope and intercept in the same units.

collatz conjecture calculator showing the 3n+1 hailstone sequence, stopping time, total stopping time, and peak value for a chosen starting integer
collatz conjecture calculator showing the 3n+1 hailstone sequence, stopping time, total stopping time, and peak value for a chosen starting integer

Frequently Asked Questions

Q: What is the Collatz conjecture?

A: The Collatz conjecture is the unsolved number theory problem that asks whether the simple rule x_{n+1} = x_n / 2 if x_n is even and x_{n+1} = 3 x_n + 1 if x_n is odd always reaches 1 for any positive starting integer. The Collatz conjecture calculator implements that exact rule and reports the stopping time and total stopping time for the starting value you choose.

Q: How do you calculate a Collatz sequence step by step?

A: Start with a positive integer x₁. If x₁ is even, divide it by 2; if it is odd, multiply it by 3 and add 1. Repeat the rule on the new value. The Collatz conjecture calculator walks the rule for as many steps as the step cap allows and prints every term.

Q: What is the stopping time of a Collatz sequence?

A: The stopping time is the number of iteration steps needed for the Collatz sequence to first produce a value strictly smaller than the starting value. For x₁ = 27 the stopping time is 96 because the value first drops below 27 (to 23) on step 96, while the total stopping time to reach 1 is 111 total steps.

Q: What is the total stopping time of a Collatz sequence?

A: The total stopping time is the number of iteration steps needed for the Collatz sequence to first reach 1. It is the value most Collatz references use when they say 'stopping time'. For x₁ = 27 the total stopping time is 111, and for x₁ = 1 the total stopping time is 0 because the starting value is already 1.

Q: Has the Collatz conjecture been solved?

A: No, the Collatz conjecture is still open. Researchers have tested starting values up to almost 3 × 10^20 and every one of them reached 1, but no proof exists that every positive integer follows the same path. The Collatz iteration is also called the 3n+1 problem and the hailstone sequence because the rule is 3n + 1 for odd terms and the values swing up and down like a hailstone in a cloud.

Q: What happens if you start the Collatz sequence with a negative number?

A: The same 3n+1 parity rule still applies, but the iteration is conjectured to fall into one of three known cycles at -1, -5, and -17 instead of reaching 1. The Collatz conjecture calculator surfaces the matched loop name in the iteration status row.