Piṅgala: Binary Numbers in Sanskrit
Prosody — Written in 300 BCE
Binary code — the system of ones and zeros that underlies every computer, smartphone, and digital device in the world — is credited to Gottfried Leibniz, who described it in 1689. Leibniz did not know that a Sanskrit grammarian named Piṅgala had described an equivalent system roughly 2,000 years earlier, in a text about poetic metres.
Piṅgala's Chandaḥśāstra (c. 300 BCE) is a treatise on Sanskrit versification — the rules governing how syllables are arranged in verse. To systematically classify all possible arrangements of short (laghu, l) and long (guru, g) syllables in a verse foot, Piṅgala developed what is essentially a binary notation system: laghu = 0, guru = 1. Every possible metre can be uniquely identified by its binary sequence.
He also described a method for converting any metre's sequence number to its binary representation and back — the same algorithm used in modern binary-to-decimal conversion. This is not a superficial resemblance: it is mathematically identical.
Piṅgala's Binary System — How It Worked
Sanskrit poetry uses two syllable types: laghu (light/short) and guru (heavy/long). In Piṅgala's notation:
l (laghu) = 0
g (guru) = 1
A three-syllable foot (triplet) has 8 possible patterns: lll, llg, lgl, lgg, gll, glg, ggl, ggg — which in binary notation are 000, 001, 010, 011, 100, 101, 110, 111 — the numbers 0 through 7. Piṅgala named each of these patterns and gave algorithms for enumerating them systematically.
He also described the Meru Prastāra — a triangular arrangement of these combinations that is structurally identical to what the West calls Pascal's Triangle, described in India 1,800 years before Pascal.
Source: Kim Plofker, Mathematics in India, Princeton University Press (2009); van Nooten, B., "Binary Numbers in Indian Antiquity," Journal of Indian Philosophy, Vol. 21 (1993)
Piṅgala Also Discovered Fibonacci Numbers
In working out the number of ways to arrange short and long syllables in metres of increasing length, Piṅgala arrived at the sequence now called the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21...). He noted that the number of metres of length n is the sum of metres of length n-1 and n-2 — which is exactly the Fibonacci recurrence relation.
This sequence was later discussed by Virahāṅka (c. 600 CE), Gopāla (c. 1135 CE), and Hemacandra (c. 1150 CE) — all Indian mathematicians working independently, all arriving at the sequence through Sanskrit metre analysis, all preceding Fibonacci (c. 1202 CE) by centuries.
Source: Parmanand Singh, "The so-called Fibonacci Numbers in Ancient and Medieval India," Historia Mathematica, Vol. 12 (1985)
"Piṅgala's Chandaḥśāstra contains, in the context of prosody, ideas that were later to become fundamental to both combinatorics and computer science."
— Kim Plofker, Mathematics in India, Princeton University Press (2009)
Sources
- • Kim Plofker, Mathematics in India, Princeton University Press (2009)
- • van Nooten, B., "Binary Numbers in Indian Antiquity," Journal of Indian Philosophy, Vol. 21 (1993)
- • Parmanand Singh, "The so-called Fibonacci Numbers in Ancient and Medieval India," Historia Mathematica, Vol. 12 (1985)
ॐ
Start learning Sanskrit — free, forever
Stories from the Rāmāyaṇa, Mahābhārata, and Bhagavad Gītā. Grammar, shlokas, etymology. 10 minutes a day. No sign-up needed to begin.
Free · No credit card · Works on mobile