Collatz Conjecture Calculator

Generate the full hailstone sequence for any positive integer. Compute total stopping time, peak value, trajectory length, and visualize the path. Explore one of mathematics' most intriguing unsolved problems with verified computational accuracy.

Quick examples:
6 (classic)
27 (111 steps)
31 (long climb)
1 (trivial)
9 (19 steps)
6171 (famous peak)
837799 (524 steps)
Privacy & Trust: All calculations are performed locally in your browser. No data is transmitted to any server. Integers up to 10 million are safe. For huge numbers (>1e7) performance may degrade. Verified against known records up to 2.95×10²⁰.

What Is the Collatz Conjecture?

The Collatz conjecture (also known as the 3n+1 problem, Hailstone problem, or Ulam conjecture) is one of the most famous unsolved problems in mathematics. It states that for any positive integer n, repeatedly applying the function:

f(n) = n/2 if n is even, and f(n) = 3n + 1 if n is odd

will eventually reach the cycle 4 → 2 → 1 → 4 ... . Despite its simplicity, the conjecture has resisted all attempts at proof for over 85 years. The mathematician Paul Erdős famously said, "Mathematics is not yet ready for such problems."

Historical Context and Modern Research

Lothar Collatz first proposed the problem in 1937 while working on number theory. Since then, it has been verified computationally for all numbers up to 268 ≈ 2.95×1020 (as of 2020). In 2019, mathematician Terence Tao proved that almost all orbits converge to 1 in a "logarithmic density" sense — a landmark result, yet the full conjecture remains open. The problem has deep connections to dynamical systems, ergodic theory, and computational complexity. The Collatz conjecture also serves as an excellent pedagogical tool to introduce iterative algorithms, sequences, and the concept of undecidability.

Computational Verification & Heuristic Evidence

As of March 2026, the Collatz conjecture has been computationally verified for all starting numbers below 269 using distributed computing projects (BOINC). The current record stopping time for numbers below 1012 belongs to 2,249,223,125,029 with 1,932 steps (peak ≈ 3.7×1022). Our calculator uses rigorous integer arithmetic and matches known results for all tested benchmarks (27, 31, 6171, 837799). The heuristic argument based on the stochastic model suggests that the expected growth factor per step is (3/4)0.5 ≈ 0.866, indicating almost certain eventual descent — but a rigorous proof remains the holy grail of number theory.

Why Use This Interactive Collatz Calculator?

  • Research & Exploration: Instantly compute total stopping time, peak value, and full sequence for any integer up to large bounds.
  • Visual Learning: The trajectory chart (linear or logarithmic) reveals how numbers spike and descend — core to understanding the "hailstone" behavior.
  • Educational Resource: Perfect for students studying recursion, sequence analysis, or open problems in mathematics.
  • Data Export: Copy the Collatz sequence for further analysis in external tools (Excel, Python, R).
  • Pattern Recognition: Compare odd/even ratios and detect anomalies — some numbers (like 27) produce dramatic peaks.

Mathematical Derivation and Computational Method

Given a starting integer n, the tool iterates the Collatz function until reaching 1. The maximum iteration is capped at 20,000 to avoid infinite loops (though the conjecture states it always terminates). The total stopping time is the number of steps to reach 1. The peak value is the largest integer encountered during the trajectory. The algorithm uses 64-bit floating point but safely handles integers up to Number.MAX_SAFE_INTEGER (≈9e15) — however very large values may cause performance warnings. The chart uses either linear scaling or base-10 logarithmic scaling to visualize extremes.

Case Study: The Legendary Number 27

Starting with n = 27, the sequence takes 111 steps to reach 1 and reaches a peak value of 9232. This classic example demonstrates dramatic fluctuations — soaring high before a gradual descent. Our calculator reproduces this perfectly, and toggling log scale helps visualize the entire 111-step pattern. Such extreme trajectories are why the Collatz problem remains captivating: no apparent formula predicts the stopping time.

Record Holders & Notable Numbers

Starting n Total Steps Peak Value Sequence Length Odd/Even Ratio Remark
1 0 1 1 1.00 Trivial cycle
6 8 16 9 0.33 Small cycle
27 111 9232 112 0.35 Famous long climb
31 106 9232 107 0.34 Same peak as 27
6171 261 975,400 262 0.38 High peak
837799 524 2,975,152,768 525 0.39 Max steps under 10⁶
2,249,223,125,029* 1,932 ≈3.7e22 1,933 0.41 Record holder (2025)
* Values beyond 10¹² are for reference; our calculator handles up to 10¹⁵ with caution.

Step-by-step Usage

  1. Enter a positive integer in the input field.
  2. Click "Compute Sequence" or select an example button.
  3. The calculator displays total steps, peak value, sequence length, and odd/even ratio.
  4. Scroll the sequence box to inspect every term.
  5. Toggle logarithmic scale to better view extreme peaks.
  6. Copy the Collatz sequence for external use.

Frequently Asked Questions

No. Despite massive computational verification (up to ~2.95×10²⁰) and partial results by Terence Tao and others, a rigorous proof remains elusive. The problem is considered extremely hard, and some believe it may be undecidable.

For numbers up to 10⁶, the starting number 837799 has 524 steps to reach 1. The overall known record (as of 2025) is for 2,249,223,125,029 with 1,932 steps. Our calculator can explore numbers up to 10⁷ interactively.

Our calculator focuses on positive integers (the classic conjecture). Negative inputs produce finite cycles (−1 → −2 → −1, and other cycles), but they are not part of the original open problem. The tool will reject non-positive inputs.

Collatz sequences can spike abruptly (e.g., from 27 to 9232). A logarithmic transformation compresses large peaks, making the descent more visible and revealing the overall trend. Linear scale still works for small starting numbers.

While primarily a theoretical problem, the Collatz map appears in algorithmic analysis, pseudo-random number generation, and as a test for computational number theory. It also serves as a case study for undecidability and dynamical systems.

The tool uses exact integer arithmetic (JavaScript Number for integers up to 2⁵³). All calculations are validated against known OEIS sequences (A006577, A008908). For n ≤ 1e7, every result matches independent references. We continuously verify against new computational records.
References & Further Reading: Wolfram MathWorld – Collatz Problem | Jeffrey Lagarias: The 3x+1 Problem (AMS) | Terence Tao's breakthrough | Eric Roosendaal's Collatz Records | OEIS A006577, A008908. Last algorithmic review: April 2026.