number theory calculators

Collatz Conjecture Analyzer

Trace the Collatz sequence from any starting integer — halving evens and applying 3n+1 to odds — until reaching 1. Reveals stopping time, maximum value reached, and sequence statistics for the famous unsolved 3n+1 problem.

About this calculator

The Collatz conjecture applies a simple rule to any positive integer n: if n is even, divide by 2; if n is odd, compute 3n + 1. Formally, f(n) = n/2 if n ≡ 0 (mod 2), or f(n) = 3n + 1 if n ≡ 1 (mod 2). Repeatedly applying f eventually reaches 1 for every starting value ever tested, though this has never been mathematically proven for all integers. The number of steps to reach 1 is called the stopping time (or total stopping time). The calculator tracks three key statistics: steps (total iterations), maxValue (the highest value the sequence reaches), and ratio = maxValue / steps, which measures how dramatically the sequence spikes. Despite its simple rule, sequences can grow to enormous values before collapsing — n=27 reaches a peak of 9232 before descending.

How to use

Enter starting_number = 6 and max_iterations = 1000. The sequence proceeds: 6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1. Steps = 8. The maximum value encountered is 16. Ratio = 16/8 = 2.0. Now try starting_number = 27: the sequence takes 111 steps, peaks at 9232, and ratio ≈ 83.2 — illustrating how a small starting number can produce a dramatically long, high-reaching sequence before finally converging to 1.

Frequently asked questions

Has the Collatz conjecture ever been proven for all positive integers?

No — the Collatz conjecture remains unproven as of 2024 and is one of the most famous open problems in mathematics. Computers have verified it for all integers up to approximately 2^68 (about 295 quintillion), but verification for finite cases cannot constitute a general proof. Mathematician Terence Tao made significant progress in 2019, proving that 'almost all' Collatz sequences do eventually reach a bounded value, but a complete proof for every positive integer is still out of reach. Paul Erdős famously said, 'Mathematics is not yet ready for such problems.'

Why do some Collatz sequences take so many more steps than others of similar size?

The stopping time has no simple closed-form relationship to the starting number; it behaves almost chaotically. Numbers whose binary representations create long runs of odd steps (repeated 3n+1 applications) before hitting an even number tend to grow large before shrinking. For instance, starting at 27 takes 111 steps and peaks at 9232, while 32 takes only 5 steps. This sensitivity to the binary structure of n means neighbouring integers can have wildly different trajectories, which is part of what makes the problem so difficult to analyse analytically.

What is the significance of the maximum value reached in a Collatz sequence?

The maximum value (peak) of a Collatz sequence reflects how dramatically the 3n+1 rule inflates a number before repeated halving brings it back down. A high peak-to-start ratio suggests the sequence 'escapes' to a large value before eventually descending to 1. Studying peak values helps researchers understand the growth dynamics of Collatz trajectories and test whether any sequence could in principle escape to infinity. The ratio of max value to steps (maxValue/steps) provided by this calculator summarises how violently the sequence oscillates on average per iteration.