Counting the spirals
Look at a sunflower and spirals appear. Follow one with a finger and it curves out to the rim; follow one going the other way and it does the same. Count them and the numbers are usually 34 and 55, or 55 and 89, or some other pair of consecutive Fibonacci numbers.
That is the observation the whole subject rests on, and it is worth asking what exactly is being counted.
What a spiral is, in a pattern made of points
A spiral in a seed head is not a curve. It is a chain of near-neighbours.
Take the point born 34 places before any given point. In a golden-angle head it sits very close by — much closer than a point 20 or 45 places earlier. Join every point to the one 34 places before it and the result is a set of 34 chains, each winding out from the centre. Those are the spirals a person traces.
So a spiral family is labelled by an offset: the number of places back in birth order that lands one on a near neighbour. The parastichy numbers of a pattern are the offsets that do this, and everything about counting spirals is about finding them.
That reframing is what makes counting a computation rather than an impression. A curve fitted to a photograph is a matter of judgement; the question of which index offset gives the shortest hop is not.
The counter, and what it is not told
The arrangement matters more than the algorithm, so it is worth being explicit.
One function in lib/lattice.js builds a head from a divergence angle. A different function is handed an array of coordinates and asked which offsets give short hops. It does not receive the angle. It does not receive the model. It does not know that Fibonacci numbers are the expected answer, and it would return 47 and 76 just as readily.
The method: for each candidate offset m, measure the distance from every point to the point m places before it, take the median, and divide by the local spacing so the answer does not depend on scale. Plot that against m and the parastichy numbers appear as local minima — offsets that give hops much shorter than their neighbours do.
Requiring a local minimum rather than simply a short hop is the part that does the work. Offset 1 always gives a shortish hop; so does offset 2. Without the local-minimum requirement the counter would report 1 and 2 for every pattern ever made, which is true and useless.
The bug that only a second route could find
The first version of this counter returned the two smallest offsets among the minima rather than the two shortest.
For a golden-angle head that means it reported 21 and 34, when the offsets that actually give the closest neighbours at that radius are 34 and 55. Both are genuine parastichy families — 21 is a real spiral family in that head — so the drawing looked entirely correct. Twenty-one spirals were drawn and there were twenty-one of them.
Nothing in the figure showed the error. What showed it was the angle recovery, which takes a pair of counts and asks which divergence angle makes those two offsets the closest. Fed 21 and 34 at that radius it refused: no angle does. The refusal was correct, and it was the only thing in the system that could tell the difference.
That is the argument for the second route in one paragraph. A count that is merely plausible cannot be distinguished from a count that is right by looking at the picture the count produced.
Showing that the counter rejects
An assertion that has never failed on anything is not a test, and on this subject that matters more than usual: a counter that always returned Fibonacci numbers would confirm every claim ever made about sunflowers.
So the build runs it on a lattice built at 45°, which is a rational angle and produces eight radial rows and no spirals at all. The counter returns 8 and 16 — the row count and its double — and not a Fibonacci pair anywhere.
That single check is what makes every other count on this site worth reading. Without it, “the counter found 34 and 55” is a statement about the counter.
Why the answer depends on where one look
The counter takes a radius band as well as a point set, and it has to, because the answer genuinely depends on it.
Near the centre of a head the points are sparse and the short offsets win: 13 and 21, or 21 and 34. Further out, the same head gives 34 and 55, then 55 and 89. The transitions happen at radii that can be computed, and they are the subject of the next essay.
This is not a defect of the method. It is the pattern being honest about itself: a spiral lattice does not have a parastichy pair, it has a parastichy pair at a radius. Every published count of a sunflower is a count in whichever annulus the counter happened to work in, and the practice of quoting one pair per flower obscures a real and computable structure.
Ambiguity at the transitions
Between one regime and the next there is a band where three offsets have almost the same hop length, and there the count is genuinely ambiguous.
At one radius in the head measured here, offset 55 gives a hop of 1.68 in units of the mean spacing, offset 34 gives 2.01, and offset 89 gives 2.10. Which pair the eye picks out — or the counter — depends on details that carry no information.
That ambiguity forced a change in the machinery. The angle recovery originally required the observed pair to be the two shortest offsets; near a transition it refused patterns it had counted correctly. It now asks for both to be among the shortest three, and reports a wider interval when the constraint is looser. The tolerance is not a fudge — it is the ambiguity of the pattern, made explicit.
What the counting does not settle
Two things, and both are usually assumed.
It does not say the counts are Fibonacci. It says what they are. That they usually come out Fibonacci in a golden-angle head is a consequence of the angle, and heads built at other angles give other sequences — Lucas numbers, or nothing named at all.
It does not say anything about real flowers. Everything here is measured on generated patterns, where the truth is available. That is deliberate: the site’s job is to establish what a count means and what it can be trusted to reveal, and a photograph would add authority the argument has not earned. What the counting establishes is that the operation is well defined and testable, which is the precondition for anyone doing it on real material and being believed.
The general shape of it
The pattern this essay repeats is the one the whole fleet is built on, and it is worth naming.
An observation that is usually made by eye — there are 34 spirals — is restated as a computable quantity: offset 34 gives a local minimum of the median hop length in this annulus. The restatement is more work, it is less evocative, and it is the difference between a claim that can be checked and one that can only be repeated.
Then the computation is shown to reject, on input where the right answer is known to be different. Then it is checked against a second, independently-shaped computation that could disagree. Only after all three does a number get quoted in a caption.
What counting is worth
The operation is unglamorous and it is what everything else on this site is built on.
The angle can be recovered because the counts carry it. The transitions across a head are visible because the count can be repeated at different radii. The Fibonacci claim can be tested because other angles can be counted too, and their counts are not Fibonacci.
None of that is available to a reader who takes the count from a caption.