🚀 Supercharge your YouTube channel's growth with AI.
Try YTGrowAI FreeThe 3x+1 Collatz Conjecture Math Problem Explained

The Collatz problem starts with any positive whole number and one rule. If the number is even you halve it, and if it’s odd you multiply it by 3 and add 1, and the conjecture asks whether repeating that always reaches 1.
You’ll follow the sequence for 27 and write a Python function that prints it for any start.
What is the Collatz conjecture?
A positive integer is a whole number greater than zero. The Collatz map applies one rule to the current value based on whether it is even or odd, then uses the result as the next input.
| Current value | Rule | Next value |
|---|---|---|
| Even n | Divide by 2 | n / 2 |
| Odd n | Multiply by 3 and add 1 | 3n + 1 |
| Conjecture | Repeat the rule from any positive integer | The sequence eventually reaches 1 |
Repeated applications form an orbit, also called a Collatz sequence. After 1 appears, its orbit repeats through 1 → 4 → 2 → 1, so the conjecture asks whether every positive start reaches that cycle.
How does the Collatz sequence behave for 27?
The Collatz conjecture’s orbit from 27 is still above its start, at 41, after two transitions.
- The first terms are 27 → 82 → 41 → 124 → 62 → 31.
- The orbit’s peak is 9,232.
- It first reaches 1 after 111 steps.
The hailstone sequence name describes values that rise and fall before reaching 1. Total stopping time counts the transitions before the first 1, which is 111 for 27.
Generate a Collatz orbit in Python
The function below accepts a positive integer and stores each value until it reaches 1. A step limit reports a cutoff when the sequence has not reached 1 within the chosen number of transitions.
import argparse
def collatz_sequence(start, step_limit=10_000):
if type(start) is not int or start < 1:
raise ValueError("start must be a positive integer")
if type(step_limit) is not int or step_limit < 0:
raise ValueError("step_limit must be a non-negative integer")
values = [start]
current = start
for _ in range(step_limit):
if current == 1:
return values
if current % 2 == 0:
current //= 2
else:
current = 3 * current + 1
values.append(current)
if current == 1:
return values
raise RuntimeError(f"sequence did not reach 1 within {step_limit} steps")
def main():
parser = argparse.ArgumentParser(description="Show one Collatz sequence.")
parser.add_argument("start", type=int, help="positive integer to start from")
parser.add_argument("--step-limit", type=int, default=10_000)
args = parser.parse_args()
try:
values = collatz_sequence(args.start, args.step_limit)
except (ValueError, RuntimeError) as error:
print(f"Stopped: {error}")
return 2
print("Start:", values[0])
print("First values:", values[:10])
print("Peak:", max(values))
print("Steps to 1:", len(values) - 1)
print("Last values:", values[-5:])
return 0
if __name__ == "__main__":
raise SystemExit(main())
The loop appends each new value before it checks the next iteration, so the final 1 stays in the returned list. I ran the function with 27 and saw its 9,232 peak before it reached 1 after 111 transitions.

I set the limit to five steps for a second run, and the program printed that it had not reached 1. That cutoff tells you only what happened within those five transitions.

A cutoff records only that 1 had not appeared within the selected limit. Raise the limit to continue testing that starting value, and keep the result scoped to that orbit.
What can a computer check establish?
A run answers a question about its tested starting value. A computer can also check a finite interval, but the Collatz conjecture makes a claim about every positive integer.
| Evidence | What it establishes | What remains open |
|---|---|---|
| Python run starting at 27 | This orbit reaches 1 after 111 transitions and peaks at 9,232. | Other starting values. |
| Barina verification project | All starting values below 2075 × 2^60 have been checked for convergence. | Starting values outside that finite bound. |
| Collatz conjecture | Every positive integer eventually reaches 1. | A proof that covers every positive integer. |
David Barina’s verification project reports that it checked all starting values below 2075 × 2^60, about 2^71.02, and its page was generated on October 2, 2026. That interval excludes a counterexample below its limit, and the conjecture still covers every larger positive integer.
Why does a proof remain difficult?
The even branch always decreases a positive value. The odd branch can increase it, and even after the required halving, the next value can still exceed the start.
- For even n, the next value is n / 2, which is smaller than n.
- For odd n greater than 1, two transitions produce (3n + 1) / 2, which can be greater than n.
- A proof must account for every possible later odd/even choice, including starts beyond the checked range.
For example, 27 moves to 82 and then to 41, so it is still above its starting value after two transitions. The value later falls, but that single orbit does not establish a rule for all starts.
If an odd n leaves remainder 1 after division by 4, the orbit reaches (3n + 1) / 4 after three transitions, below n for n greater than 1. If the remainder is 3, the first halving leaves an odd value, and applying the rule again increases it.
Tao’s theorem states an almost-all result using logarithmic density. This measure concerns sets of integers on a logarithmic scale, and the paper shows that almost every starting value’s orbit falls below any chosen function that grows without bound.
An almost-all result can leave exceptional values, so the universal claim still needs a proof for every positive integer.
If an orbit avoids 1 and stays bounded, some integer must repeat, which creates a cycle under this deterministic rule. If it avoids 1 without repeating, it must be unbounded, giving two possible forms for a counterexample.
Tao’s paper states the theorem precisely. His research note works through why average behavior does not settle the claim for every start.
A Collatz orbit answers for one start
Use the program to inspect another orbit’s peak and total stopping time. Its output describes that start, so a proof still needs to cover every positive integer.
python3 collatz_demo.py 97
Collatz conjecture questions
Has the Collatz conjecture been proven?
No proof or counterexample is known, so the conjecture remains open.
How far has the Collatz conjecture been computationally verified?
David Barina’s project reports that all starting values below 2075 × 2^60 have been checked. The conjecture still asks for a proof covering every positive integer.
What would a counterexample to the Collatz conjecture look like?
A counterexample would be an orbit that never reaches 1. It would either enter another cycle or remain unbounded.
What is the importance of the Collatz conjecture?
Its appeal is the difference between a short rule you can apply to one integer and a claim about every positive integer. A finite computation tests one range, so proving the conjecture requires an argument for all starts.


