Pingala's Binary: The First 0s and 1s
How Sanskrit prosody invented binary numbers 2,000 years before computers
Discover Piṅgala's Chandaḥsūtra, the 3rd-century-BCE Sanskrit text whose Chapter 8 contains the oldest surviving binary number system in world literature, the earliest technical use of the word śūnya, and the arithmetic triangle that Europe would later call Pascal's triangle.
The Grammarian Who Saw Two
Somewhere between the third and second century BCE, a Sanskrit scholar named Piṅgala sat down to write a complete handbook of Sanskrit prosody. Sanskrit poetry was built on syllable weight. Every syllable in a verse was either laghu, light and short, or guru, heavy and long, and the difference was felt in the throat: one held the voice for a count of one, the other for a count of two. A meter of six syllables had sixty-four possible patterns of light and heavy. A meter of eight syllables had two hundred and fifty-six. A prosodist who wanted to name every meter, list every pattern in order, and convert a pattern to its position in the list needed a system. Without one, the field was a tangle of named exceptions with no underlying logic.
Piṅgala took two symbols: la for laghu (light) and ga for guru (heavy). They were abbreviations of ordinary Sanskrit words, not invented tokens. Then he wrote four procedures that, read in modern terms, contain the binary number system, the oldest recursive halving algorithm in world literature, and the triangular table of numbers that Europe would later name after Blaise Pascal. He was solving a problem in poetry. That was the only problem he thought he was solving.

The popular history of binary credits Gottfried Wilhelm Leibniz, who in 1703 published a paper in the Mémoires of the Paris Royal Academy. Leibniz himself credited the Chinese I Ching. This story is missing a chapter. The oldest systematic treatment of binary numeration anywhere in world literature is in Piṅgala's Chandaḥsūtra, written roughly 1,900 years before Leibniz.

The Problem Piṅgala Was Solving
Sanskrit poetry is built on syllable weight, not syllable count alone. Every syllable in a Sanskrit verse is either laghu (light, short) or guru (heavy, long), and the rhythmic character of a meter is fixed by the exact sequence in which light and heavy syllables appear. A meter of n syllables therefore has two raised to the n possible patterns of light and heavy. For n equal to six, that is sixty-four. For n equal to eight, it is two hundred fifty-six. For the standard anuṣṭubh meter of eight syllables per quarter, the total number of possible patterns is already two hundred fifty-six, and a poet needs to be able to name each one, compare them, and recognize them.