Collatz Conjecture
Explore the Collatz conjecture, the 3n + 1 problem: take a whole number, halve it if it is even, or multiply it by 3 and add 1 if it is odd, and repeat. Type any start up to 40 digits and the tool works out the whole sequence with exact whole-number (BigInt) arithmetic, counts the steps to 1 and the odd steps, finds the peak, and charts it on a linear or log scale. Draw the coral of every start in a range (each number hangs off the next one in its sequence, turning one way for even numbers and the other way for odd ones), or the inverse tree that grows out of 1. Download a PDF, a 300 DPI PNG, an SVG or the numbers as CSV. Nothing is uploaded.
100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.
Print at 100% (Actual size). Real size prints on one sheet when the drawing fits; the check bar in the footer lets you confirm the scale. The SVG holds the drawing at the printed size. The CSV holds the sequence (or every start in the coral, or every number in the tree).
Collatz
Look
Page
Runs in your browser with our own code: nothing you type is uploaded or saved. Every value is worked out with exact whole-number (BigInt) arithmetic, and the coral and tree are drawn from those same computed sequences. You may use what you make here, including commercially, with no credit needed.
How to explore the Collatz conjecture
- Pick a preset, or choose what to show: one sequence, the coral or the inverse tree.
- Type the start number, the range of starts or the depth of the tree.
- Choose the scale, the turns, the colours and the line width.
- Choose Fitted to one page or Real size and the paper.
- Download the PDF and print at 100% (Actual size), or the PNG, SVG or CSV.
What you can use it for
- Maths lessons on the 3n + 1 problem
- Checking the steps and peak of any number
- Coral and seaweed line art from the sequences
- Plotter and laser line art from the SVG
- Spreadsheets of sequences from the CSV
- Posters of the inverse tree
The 16 presets
| Preset | Shows | Setting | Result |
|---|---|---|---|
| Sequence of 27: 111 steps, peak 9,232 | Sequence | start 27 | 111 steps, peak 9,232 |
| Sequence of 27 on a log scale, odd steps marked | Sequence | start 27 | 111 steps, peak 9,232 |
| Sequence of 97: 118 steps | Sequence | start 97 | 118 steps, peak 9,232 |
| Sequence of 871: the most steps below 1,000 (178) | Sequence | start 871 | 178 steps, peak 190,996 |
| A power of 2: 1,024 halves to 1 in 10 steps | Sequence | start 1,024 | 10 steps, peak 1,024 |
| A 20-digit start (BigInt): 2^64 + 1 | Sequence | start 184467…1617 (20 digits) | 483 steps, peak 553402…4852 (20 digits) |
| Sequence of 63,728,127: 949 steps (log scale) | Sequence | start 63,728,127 | 949 steps, peak 966,616,035,460 |
| Coral: every start from 1 to 1,000 | Coral | starts 1–1,000, +8° / −16° | 2,228 numbers, longest 178 steps |
| Coral: 1 to 5,000, turns +8 and -16 degrees | Coral | starts 1–5,000, +8° / −16° | 10,871 numbers, longest 237 steps |
| Coral: 1 to 10,000 on a dark background | Coral | starts 1–10,000, +7° / −14° | 21,664 numbers, longest 261 steps |
| Seaweed: small turns (+5 and -10 degrees) | Coral | starts 1–3,000, +5° / −10° | 6,520 numbers, longest 216 steps |
| Tight curl: turns +15 and -25 degrees | Coral | starts 1–2,000, +15° / −25° | 4,358 numbers, longest 181 steps |
| Inverse tree from 1, depth 10, numbers shown | Inverse tree | depth 10 | 29 numbers (6 odd) |
| Inverse tree, depth 16, numbers shown | Inverse tree | depth 16 | 132 numbers (29 odd) |
| Inverse tree, depth 22 (lines only) | Inverse tree | depth 22 | 546 numbers (113 odd) |
| Real size: coral 1 to 2,000, 150 mm wide | Coral | starts 1–2,000, +8° / −16° | 4,358 numbers, longest 181 steps |
Every count is worked out by the tool from the sequences it draws.
Steps and peaks of some starts
| Start | Steps to 1 | Odd steps | Peak | Peak at step |
|---|---|---|---|---|
| 1 | 0 | 0 | 1 | 0 |
| 2 | 1 | 0 | 2 | 0 |
| 7 | 16 | 5 | 52 | 5 |
| 9 | 19 | 6 | 52 | 8 |
| 27 | 111 | 41 | 9,232 | 77 |
| 97 | 118 | 43 | 9,232 | 84 |
| 871 | 178 | 65 | 190,996 | 31 |
| 6,171 | 261 | 96 | 975,400 | 78 |
| 77,031 | 350 | 129 | 21,933,016 | 103 |
| 837,799 | 524 | 195 | 2,974,984,576 | 58 |
| 63,728,127 | 949 | 357 | 966,616,035,460 | 74 |
The start with the most steps below each limit
| Limit | Start | Steps |
|---|---|---|
| below 10 | 9 | 19 |
| below 100 | 97 | 118 |
| below 1,000 | 871 | 178 |
| below 10,000 | 6,171 | 261 |
| below 100,000 | 77,031 | 350 |
Found by working out every start below the limit.
Powers of 2 only halve
| Start | Value | Steps |
|---|---|---|
| 2^1 | 2 | 1 |
| 2^5 | 32 | 5 |
| 2^10 | 1,024 | 10 |
| 2^20 | 1,048,576 | 20 |
| 2^64 | 184467…1616 (20 digits) | 64 |
| 2^100 | 126765…5376 (31 digits) | 100 |
The inverse tree: numbers at each depth
| Steps to 1 | Numbers with exactly this many steps | Smallest | Largest | Numbers within this many steps |
|---|---|---|---|---|
| 5 | 2 | 5 | 32 | 7 |
| 8 | 4 | 6 | 256 | 17 |
| 10 | 6 | 24 | 1,024 | 29 |
| 12 | 10 | 17 | 4,096 | 47 |
| 15 | 24 | 22 | 32,768 | 103 |
| 18 | 44 | 28 | 262,144 | 212 |
| 20 | 72 | 18 | 1,048,576 | 342 |
| 22 | 113 | 72 | 4,194,304 | 546 |
| 24 | 179 | 49 | 16,777,216 | 868 |
The largest number at depth d is always 2^d (halving all the way down).
What prints
| Download | What is in it |
|---|---|
| The chart, coral or tree fitted to one page or at real size, vector lines, with the values used and a check bar | |
| PNG 300 DPI | The same sheet as a picture |
| SVG | The drawing at the printed size as vector lines, with the labels as text |
| CSV | The numbers behind the drawing |
For a cutter that needs DXF, use SVG to DXF.
Which tool to use
| You want | Use |
|---|---|
| Collatz sequences, coral and tree | Collatz Conjecture (this page) |
| Primes laid out on a spiral | Ulam Spiral |
| Period doubling and chaos in the logistic map | Bifurcation Diagram |
| Mandelbrot, Julia and line fractals | Fractal Generator |
Other tools: the Fractal Generator renders Mandelbrot, Julia and line fractals, Graph Paper prints grids for working by hand and the Random Number Generator picks starts for you.
More free tools
Maths art, patterns and printables?
Drawing and print tools that run privately in your browser, with no sign-up and no watermark.
Frequently asked questions
What is the Collatz conjecture?
Start with any positive whole number. If it is even, halve it; if it is odd, multiply it by 3 and add 1. Repeat. The conjecture says that every start eventually reaches 1. It is named after Lothar Collatz, who introduced the idea in 1937, and it is still unproven: the Wikipedia article on the Collatz conjecture (read 13 November 2026) lists it as one of the most famous unsolved problems in mathematics.
Does this tool prove it?
No. It works out the sequences of the numbers you give it, nothing more. However many numbers reach 1, that does not show that every number does.
How many steps does 27 take?
111 steps to reach 1, 41 of them odd (3n + 1) steps, climbing as high as 9,232 at step 77. The tool works this out, and the figures match the Wikipedia article.
What counts as a step?
One application of the rule: halving an even number, or 3n + 1 on an odd one. The count stops when the sequence reaches 1, so 1 itself takes 0 steps and 2 takes 1. A power of 2 such as 1,024 = 2^10 only halves, so it takes exactly 10 steps; the table checks powers up to 2^100.
Why exact whole numbers?
Ordinary JavaScript numbers lose exactness above 2^53 (about 9 quadrillion), and many sequences climb past that. The tool uses BigInt, so every value is exact. Starts can have up to 40 digits and a sequence can run for up to 20,000 steps; a run that hits that cap is marked as stopped at the cap, which says nothing about whether it would reach 1.
What is the coral picture?
Every start in the range is followed to 1, and the numbers are joined into one tree rooted at 1: each number hangs off the next one in its sequence, at the same length, turning left for even numbers and right for odd ones. Because sequences merge, the starts share branches. Our tests check that every segment joins a number to the next one in its computed sequence.
What is the inverse tree?
The tree of every number that reaches 1 within a set number of steps, grown backwards from 1. The children of a number m are 2m and, when m leaves remainder 4 on division by 6, the odd number (m − 1) / 3 (except 1). Our tests check that every number in the tree is one step from its parent and that its depth equals its step count.
Which numbers take the most steps?
The table below lists, for each limit, the start with the most steps below it, found by checking every start: for example 871 takes 178 steps, the most below 1,000. These are computed here, not quoted.
What is in the CSV?
For one start: every step, value, parity and digit count. For the coral: every start in the range with its steps and peak. For the tree: every number with its depth and parent.
How big can it go?
Starts up to 40 digits and 20,000 steps, coral ranges up to 10,000 starts, tree depth up to 24; every preset draws in under 2 seconds in our tests.
Can it print at real size?
Yes, when the drawing fits on one sheet: choose Real size and set the printed width. Every printed point is within 0.2 mm of its true place in our tests, on US Letter and A4, as long as you print at 100% (Actual size); the check bar in the footer lets you confirm the scale. Bigger drawings print fitted to the page.
Is it free?
Yes. There is no sign-up, no watermark and no limit.
Is anything uploaded?
No. Every value is worked out by JavaScript in your browser. Nothing you type is sent anywhere or saved when you close the page.