⟵ Artificial Wasteland  ·  Ground Truth → Pattern

The Trees That Carbon Grows

One rule — a carbon makes four bonds and the skeleton holds no rings — grows every shape an alkane can take. Count them, and you are counting trees.

A molecule of alkane is the simplest thing carbon and hydrogen make: only single bonds, no rings, fully saturated. Fix the number of carbons at n and the formula is forced — CnH2n+2 — because every bond a carbon does not spend on another carbon is filled by a hydrogen. Butane is C₄H₁₀. But there are two butanes: the four carbons in a row, and three in a row with the fourth hung off the middle. Same formula, different molecule. They are isomers.

Here is the move that turns chemistry into mathematics. Throw away the hydrogens — they only fill the gaps — and an alkane's carbon skeleton is a tree: n dots, n−1 bonds, no loops, all connected. The one chemical fact left is that carbon makes four bonds, so no dot may touch more than four others. That is the whole rule. The number of alkanes with n carbons is exactly the number of distinct trees on n dots with no dot of degree more than four — counting two trees as the same when one can be bent into the other.

So count them. The instrument below does it the honest way: it generates every skeleton, one at a time, throws away the duplicates, and draws what is left.

Generate every alkane skeleton

carbons n =
choose a number of carbons.

The counts start out lazy — one, one, one, two — and then they detonate. Five carbons make 3 skeletons; ten make 75; twenty make over three hundred thousand. The explosion is why "draw all the isomers of decane" is a real exam question and "draw all the isomers of C₂₀H₄₂" is not. Below, the sequence is computed live in your browser by a second, independent method (a generating-function recurrence — no skeletons drawn, just counted), out to twenty carbons.

The isomer count, n = 1 to 20

Computed live by the Pólya–Otter recurrence (exact BigInt arithmetic). This is OEIS A000602. The two rows tinted red are where the man who invented this count got it wrong.

Where Cayley miscounted

The mathematician Arthur Cayley set this problem down in 1875 — alkanes as four-valent trees — and it is one of the founding results of chemical graph theory. He tabulated the counts by hand, through thirteen carbons. He got the first eleven right. And then, at the end of his own table, he made two arithmetic mistakes.

Cayley printed 357 for twelve carbons; the right number is 355. He printed 799 for thirteen; the right number is 802. The error was caught five years later by F. Hermann (1880), working by a different method, who gave the correct totals 355 and 802. It is a small, human, hand-arithmetic slip in a beautiful idea. Hermann fixed the totals quickly — but Cayley had also published separate counts of centred and bicentred skeletons, and those went unchecked until Rains and Sloane recomputed and extended the whole table in 1999, by their reckoning possibly the first full verification in 124 years.

The point of this page is not that Cayley erred. It is that you do not have to take anyone's word for it. Press 12 and 13 in the counter above and watch it generate all 355 dodecane skeletons and all 802 tridecane skeletons — independently of Cayley, in your browser. Where his printed table and this computation disagree is exactly n = 12 and n = 13, and nowhere else; everywhere before, they agree to the number. That disagreement is checkable, so it is shown rather than asserted.

What this does and does not count

This counts constitutional isomers — who is bonded to whom. It does not count stereoisomers: the same skeleton can come in mirror-image forms that cannot be superimposed, when a carbon carries four different groups. Counting those too gives a different, strictly larger sequence (OEIS A000628). The numbers here are the smaller, skeletal count, and the verifier checks that boundary by also computing the count of all trees (no degree cap) and confirming the four-bond rule really does throw shapes away — the six-carbon star, one carbon bonded to five others, is a perfectly good tree and an impossible molecule.

Hydrogen, likewise, adds nothing to count: its number is pinned by the carbons. The whole combinatorial freedom of an alkane lives in its carbon tree. That is the quiet astonishment — the entire variety of the paraffins, candle wax to gasoline, is one law about a dot that touches at most four others, iterated.

Show the check. Every count on this page is reproduced offline by research/alkane-isomers/verify.mjs — 75/75 checks, exact BigInt arithmetic. It counts the alkanes three independent ways — brute-force skeleton generation (n ≤ 14), the Pólya–Otter recurrence (n ≤ 20), and the published OEIS values — and requires all three to agree; it confirms Cayley's 357 and 799 are wrong where ours are 355 and 802; and it checks the degree-4 cap against the count of all trees. Full record: facts.md. The same brute-force generator runs above, in your browser, so the small counts can be checked by eye.