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.

100% private — runs in your browser

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

  1. Pick a preset, or choose what to show: one sequence, the coral or the inverse tree.
  2. Type the start number, the range of starts or the depth of the tree.
  3. Choose the scale, the turns, the colours and the line width.
  4. Choose Fitted to one page or Real size and the paper.
  5. 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

PresetShowsSettingResult
Sequence of 27: 111 steps, peak 9,232Sequencestart 27111 steps, peak 9,232
Sequence of 27 on a log scale, odd steps markedSequencestart 27111 steps, peak 9,232
Sequence of 97: 118 stepsSequencestart 97118 steps, peak 9,232
Sequence of 871: the most steps below 1,000 (178)Sequencestart 871178 steps, peak 190,996
A power of 2: 1,024 halves to 1 in 10 stepsSequencestart 1,02410 steps, peak 1,024
A 20-digit start (BigInt): 2^64 + 1Sequencestart 184467…1617 (20 digits)483 steps, peak 553402…4852 (20 digits)
Sequence of 63,728,127: 949 steps (log scale)Sequencestart 63,728,127949 steps, peak 966,616,035,460
Coral: every start from 1 to 1,000Coralstarts 1–1,000, +8° / −16°2,228 numbers, longest 178 steps
Coral: 1 to 5,000, turns +8 and -16 degreesCoralstarts 1–5,000, +8° / −16°10,871 numbers, longest 237 steps
Coral: 1 to 10,000 on a dark backgroundCoralstarts 1–10,000, +7° / −14°21,664 numbers, longest 261 steps
Seaweed: small turns (+5 and -10 degrees)Coralstarts 1–3,000, +5° / −10°6,520 numbers, longest 216 steps
Tight curl: turns +15 and -25 degreesCoralstarts 1–2,000, +15° / −25°4,358 numbers, longest 181 steps
Inverse tree from 1, depth 10, numbers shownInverse treedepth 1029 numbers (6 odd)
Inverse tree, depth 16, numbers shownInverse treedepth 16132 numbers (29 odd)
Inverse tree, depth 22 (lines only)Inverse treedepth 22546 numbers (113 odd)
Real size: coral 1 to 2,000, 150 mm wideCoralstarts 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

StartSteps to 1Odd stepsPeakPeak at step
10010
21020
7165525
9196528
27111419,23277
97118439,23284
87117865190,99631
6,17126196975,40078
77,03135012921,933,016103
837,7995241952,974,984,57658
63,728,127949357966,616,035,46074

The start with the most steps below each limit

LimitStartSteps
below 10919
below 10097118
below 1,000871178
below 10,0006,171261
below 100,00077,031350

Found by working out every start below the limit.

Powers of 2 only halve

StartValueSteps
2^121
2^5325
2^101,02410
2^201,048,57620
2^64184467…1616 (20 digits)64
2^100126765…5376 (31 digits)100

The inverse tree: numbers at each depth

Steps to 1Numbers with exactly this many stepsSmallestLargestNumbers within this many steps
525327
84625617
106241,02429
1210174,09647
15242232,768103
184428262,144212
2072181,048,576342
22113724,194,304546
241794916,777,216868

The largest number at depth d is always 2^d (halving all the way down).

What prints

DownloadWhat is in it
PDFThe chart, coral or tree fitted to one page or at real size, vector lines, with the values used and a check bar
PNG 300 DPIThe same sheet as a picture
SVGThe drawing at the printed size as vector lines, with the labels as text
CSVThe numbers behind the drawing

For a cutter that needs DXF, use SVG to DXF.

Which tool to use

You wantUse
Collatz sequences, coral and treeCollatz Conjecture (this page)
Primes laid out on a spiralUlam Spiral
Period doubling and chaos in the logistic mapBifurcation Diagram
Mandelbrot, Julia and line fractalsFractal 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.

See all free tools →

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.