Collatz Sequence Length Calculator
Count the steps a number takes to reach 1 in the 3n+1 sequence, plus the highest value it hits.
Result
How it is calculated
Enter a positive whole number. The tool repeats the Collatz rule until the value reaches 1: if the current value is even, halve it; if it is odd, replace it with 3 × value + 1. Each application of the rule is one step. It reports two results: the number of steps and the highest value the sequence reached (the starting number itself counts as a candidate for the peak). Starting at 1 gives 0 steps. Zero, negative numbers and decimals such as 27.9 show no result; they are rejected rather than rounded. Values above 253 (9,007,199,254,740,992) are also rejected, because beyond that point integers can no longer be held exactly. Whole numbers typed with a trailing .0 are accepted.
Worked example
Start with 27. The sequence begins 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214 and keeps climbing and falling for a long time. The highest value it touches is 9,232, and 1 is reached after 111 steps, so the tool shows 111 steps and a peak of 9,232. Compare that with 16, which goes 8, 4, 2, 1 in just 4 steps and never rises above its starting value.
Common mistakes
- Assuming a larger start means more steps. 27 needs 111 steps, while the larger 64 needs only 6 and 28 needs 18.
- Thinking the tool proves the conjecture. It only follows one starting number down to 1; whether every number does so is still an open question.
- Entering a decimal or negative number and expecting it to be rounded. Anything that is not a whole number of at least 1 gives no result.
- Confusing the step count with the length of the sequence. The count is the number of operations, so the list of values has one more entry than the steps, counting the start.
- Reading the peak as the last value before 1. The peak is the single highest value anywhere in the sequence and is often reached early.
About this calculator
The Collatz conjecture (also called the 3n+1 problem) starts from a simple rule applied repeatedly to any positive integer: if the number is even, divide it by 2; if it’s odd, multiply by 3 and add 1. The conjecture — unproven despite being checked for every integer up into the quintillions — claims that no matter which starting number you pick, this process always eventually reaches 1. This calculator counts how many steps that takes, and tracks the highest value the sequence hits along the way.
Some starting numbers reach 1 in a handful of steps; others, like 27, balloon up past 9,000 before finally descending, which is part of what makes the conjecture so notoriously hard to prove despite its childishly simple rule. It’s a favorite in recreational mathematics and a classic first exercise in programming courses for practicing loops and conditionals, and it remains a genuinely open problem in number theory — Paul Erdős famously said mathematics wasn’t ready for it.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments