◄ WORLD V · SONNY 5DART 188 · a helldive at the net

THE FAREY SEQUENCE every fraction to a bound, in order, by mediants

The Farey sequence Fₙ is every fraction in [0,1] in lowest terms with denominator at most n, listed in increasing order. Its magic: any two neighbours a/b, c/d satisfy bc - ad = 1, and the fraction that first appears between them is their mediant (a+c)/(b+d) — so the whole ordered list is generated with integer add and compare, never a floating-point sort.

THE TECHNIQUE next term from the last two, exactly

Generate F₅ from 0/1 and 1/5 by the neighbour recurrence — each term computed from the previous two with integers only. Watch the ordered fractions appear, every adjacent pair with bc-ad=1: live demo


HISTORY & CREDIT Haros 1802; not Farey 1816

“Farey discovered the Farey sequence.” — no. Charles Haros published the construction and the neighbour property in 1802; John Farey only observed the mediant property in 1816 (with no proof), and Cauchy proved it — then attached Farey’s name. Hardy noted pointedly that Farey “is immortal because he failed to understand a theorem which Haros had proved perfectly fourteen years before.” cited

1802 · Charles Haros — constructs the ordered fractions and the neighbour rule, to tabulate decimal equivalents.
1816 · John Farey — a geologist, notes the mediant property in a letter (no proof); Cauchy reads it, proves it, and credits Farey — the name sticks.
kin · the Farey neighbours share the Stern-Brocot tree’s mediants and bc-ad=1 unimodularity (dart 092) — though Fₙ is built by inserting mediants with bounded denominator, not by reading one tree level.

That bc - ad = 1 for neighbours is unimodularity: consecutive Farey fractions are the columns of a determinant-1 matrix, which is why the mediant is always already in lowest terms — the same integer structure the Stern-Brocot tree computes without storing. Haros 1802 / Farey 1816

RECOMMEND FOR I-13 the ordered fractions, computed

On the canonical compiler the neighbour recurrence generates F₅ from the last two terms — integer arithmetic, exact order:

$ i13 run farey.i13 # from 0/1, 1/5 by k = floor((n+q_prev)/q_cur); next = (k*p - p_prev)/(k*q - q_prev) after 0/1, 1/5: k=1 -> 1/4 k=2 -> 1/3 ... F_5 = 0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1/1
Recommend: the Farey sequence is LIT on I-13 — verified the neighbour recurrence generates F₅ (0/1, 1/5, 1/4, 1/3, …) from the previous two terms with pure integer add, multiply and compare, no floating-point sort. It shares the Stern-Brocot tree’s mediants and bc-ad=1 unimodularity (the corpus’s computed-not-stored keeper, dart 092), presented as an ordered list bounded by denominator rather than a top-down tree — the same seam, a different orientation. For any I-13 that needs best rational approximations or an exact ordering of fractions, this is the mechanism — and a reminder that a whole ordered set can be computed one step at a time rather than built and sorted.