Skip to content
Pingala's Chandahshastra, Dated to About the Second Century BCE, Lists Every Pattern of Short and Long Syllables, Numbers Them in an Order That Matches Binary Counting and Counts Them by Doubling
Science & Space

Pingala's Chandahshastra, Dated to About the Second Century BCE, Lists Every Pattern of Short and Long Syllables, Numbers Them in an Order That Matches Binary Counting and Counts Them by Doubling

Illustration by tuput

English

Pingala's Chandahshastra, dated by Jayant Shah and others to about the second century BCE, closes with rules that list every pattern of short and long syllables, find any pattern from its number and count the patterns. Read with the short syllable as 1 and the digits reversed, its numbering matches binary counting, and historians differ on how much that shows.

· · 10 min read

The Chandahshastra, a Sanskrit manual of poetic metre attributed to Pingala, ends with a run of short rules that list every possible pattern of short and long syllables, find any pattern from its position in the list, and count the patterns. Three syllables give eight patterns and six give 64. Jayant Shah of Northeastern University writes that the Indian tradition of combinatorics, the mathematics of counting arrangements, began with this formal theory of metres, which he dates to the second century BCE.

The numbering of the patterns also matches counting in binary, if the short syllable is read as 1, the digits are reversed and the count starts at one. The scholars cited here agree on that arithmetic. They differ on whether it shows that Pingala had the idea of binary numbers, and this article keeps the two apart. The sutra (aphorism) wordings below are as quoted and translated by Shah and by Amba Kulkarni of the University of Hyderabad.

A manual of metres that ends in mathematics

Kulkarni calls the Chandahshastra the earliest treatise found on the Vedic Sanskrit metres. Shah and a 2026 paper by Nuh Aydin and colleagues give the second century BCE, Divakaran says the third to second century BCE and Kulkarni writes 200 BC. Subhash Kak argues for the fifth century BCE, if the old tradition is right that Pingala was a younger brother of the grammarian Panini, a tradition that Kak and Parmanand Singh both trace to the commentator Sadgurushishya. Panini and his rule system are covered in our article on the Ashtadhyayi.

Every Sanskrit syllable is either laghu, light or short, worth one matra (a unit of time), or guru, heavy or long, worth two. Pingala’s notation uses G and L, and a line of n syllables is a string of n such letters. Poets used only a few of the possible strings. Shah observes that the closing theory has no practical use in prosody and is “apparently mathematics for its own sake”.

In Kulkarni’s edition the eighth chapter has 35 sutras, and the last 16 (8.20 to 8.35) deal with the counting.

Eight patterns from three syllables

The first rules build the list, which Sanskrit prosodists call the prastara, the “spread”. Sutra 8.20, dvikau glau, gives the one-syllable metre two forms, G and L, and sutras 8.21 (misrau ca, “and mixed”) and 8.22 repeat the step. In Shah’s account, the procedure makes two copies of the list for the shorter length, adds G to the end of each entry in one copy and L to each entry in the other, and joins the copies.

One syllable gives G, L. Two give GG, LG, GL, LL. Three give GGG, LGG, GLG, LLG, GGL, LGL, GLL, LLL. Sutra 8.23, vasavastrikah, states that there are eight (vasu) triples. Pingala gives each of the eight a short code, m, y, r, s, t, j, bh and n, in the order just listed. Kulkarni points out that the same step is understood to repeat for longer metres, so four rules are enough to produce every list.

Kak records a memory string for the eight codes, yamatarajabhanasalagam, which read as a ring runs through all eight three-syllable patterns once each. Its age is open: Kak calls it plausibly ancient and says that is not a proof.

Finding the sixth pattern without writing out the list

Two rules let a reader jump to any entry. The nashta rule (“the lost row”), in sutras 8.24 and 8.25, turns a position into a pattern. Write L if the number is even and halve it, or write G if it is odd and halve the number after adding one. Repeat until the pattern has enough syllables. Shah’s example is position 6, which gives L, then G, then L. Entry 6 comes out as LGL for three syllables, LGLG for four and LGLGG for five.

The uddishta rule (“the pointed-out row”), in sutras 8.26 and 8.27, runs the process backward. Start at 1 and scan the pattern from the right, skipping any G at the far end. At the first L, double the number. After that, double at each L, and at each G double and then subtract one. Take LGLG: the rightmost L gives 2, the G to its left gives 2 times 2 minus 1, which is 3, and the first L gives 6.

Kulkarni and Kak read this as binary arithmetic. Write L as 1 and G as 0, subtract one from the position, and write the result in binary with the least significant digit first. Entry 6 of the four-syllable list, LGLG, is 1010, which reversed is 0101, or 5, and 5 is 6 minus 1. Kulkarni names two differences from modern practice: higher place values sit on the right, and the count starts at 1. Kak concludes that Pingala understood the binary system perfectly.

Divakaran reads the same facts more cautiously. In his FPSAC talk he grants that the ith entry corresponds to the binary form of i minus 1 once the digits are read backward with L as 1, but he points out that, as listed, neither assignment of 0 and 1 to G and L turns the list into binary numbers in their usual order. In his account Pingala’s rules use no explicit binary numbers, place-value numerals and a zero symbol were 600 to 700 years away, and ten was always the base in India.

The clearest step toward binary numbers comes later, in Shah’s reading. Mahavira, whom Shah’s table dates to about 850 CE, replaced Pingala’s rule with one that writes the powers of 2 above the syllables and sets the position to one plus the sum of the values over each L. Shah calls this “the closest Indian mathematicians came to inventing binary numbers”, and adds that Bharata’s Natyashastra, a text of the second century BCE to the first century CE, seems to outline the same method in its verse 121.

Sixty-four patterns without counting to 64

Pare purnam (“next, full”) says that each added syllable doubles the number of patterns. In Shah’s reading the pair of closing sutras is a recursion, a rule that defines each count from the one before it: the count for n plus 1 syllables is twice the count for n.

Pingala also gives a faster way to find the total, the sankhya rule. If the number of syllables can be halved, find the answer for the half and square it. If it cannot, subtract one, find the answer, and double it. Shah works six syllables through: 6 halves to 3, 3 becomes 2, 2 halves to 1, and 1 becomes 0. Working back up gives 2, then 4 by squaring, then 8 by doubling, then 64 by squaring. The word shunya, “void”, labels the odd case in the rule, and Divakaran reads it as an early appearance of zero as a number. Computer scientists call the method divide and conquer, as Shah notes.

A neighbouring rule sums the doubling series: twice the count for n syllables, less 2, equals the counts for lengths 1 to n added together. Three syllables give 2 plus 4 plus 8, which is 14, which is 16 minus 2. Later Indian mathematicians reused this halve-and-square wording for geometric series, Shah reports, and Narayana Pandita repeats it almost verbatim in the Ganitakaumudi of 1356.

The halve-and-square rule has been claimed as a discovery of binary exponentiation, the square-and-multiply method used in modern cryptography. Aydin and his co-authors say Donald Knuth’s The Art of Computer Programming credits Pingala with an early appearance of the method, before 400 AD, and that blogs and other secondary sources repeat the credit without checking the primary text. In their reading Pingala’s use sits inside the counting of metres and is not stated as a general rule for any base. They find the first explicit general rule in al-Kashi’s work of 1427 and conclude that the method turned up several times independently.

The last of the six procedures, adhvayoga, measures how much space the list needs. Janashraya, a writer Shah dates to about 600 CE, set each line at one finger’s width and found that the 24-syllable list needs 33,554,431 finger-widths, a number that equals twice 2 to the 24th power, less one. Shah converts that to about 265 miles.

How many patterns have exactly two short syllables

The fifth question the text answers is how many of the patterns have a given number of short syllables, which is the binomial coefficient of modern algebra. Of the 64 six-syllable patterns, 15 have exactly two L’s.

The standard answer is the triangle that Europe calls Pascal’s, known in Sanskrit as meru prastara, the “mountain spread”. The commentator Halayudha wrote out the construction: one cell on top, two below, then three, each cell the sum of the two above. Shah’s version for six syllables has a bottom row of 1, 6, 15, 20, 15, 6, 1, the numbers of patterns with none, one, two and up to six short syllables, and the row adds to 64.

Halayudha attached the construction to Pingala’s last two sutras. Shah tested this against the works of the prosodists who wrote before Halayudha and does not accept it. As written, the two sutras say “next, full” twice and repeat the doubling rule. On this Shah sides with the German scholar Albrecht Weber, who objected to Halayudha’s reading, and with the plain sense of the Sanskrit. He still traces the binomial count to Pingala, through another sutra that Weber quotes from the Yajur version of the text, ekottarakramashah purvaprkta lasankhya. He reads it as an instruction to form partial sums of 1, 2, up to n, again and again, and shows that the Natyashastra’s verses 124 to 127 describe the same step in fuller words. The numbers that result form a rotated version of the same triangle.

The first appearance of the construction Halayudha describes is in Virahanka’s Vrittajatisamuccaya, which Shah dates to the seventh century. Virahanka gives two constructions, the suci prastara (“needle spread”), built from partial sums, and the meru prastara. Divakaran writes the recurrence as the count for n syllables with k short ones equal to the count for n minus 1 and k minus 1, plus the count for n minus 1 and k.

A second count that gives the Fibonacci numbers

If a short syllable counts one beat and a long syllable two, the question changes to how many patterns have a total length of n beats. The answers for one to six beats are 1, 2, 3, 5, 8 and 13, as Singh sets out in a 1985 paper in Historia Mathematica. Each is the sum of the two before, and Shah gives the recurrence as Virahanka’s extension of Pingala’s method to beat-counted metres.

Singh dates Virahanka between 600 and 800 CE, Gopala before 1135 and Hemachandra to about 1150, all before Fibonacci’s c. 1202. Pingala’s own list of four-beat feet, which Shah quotes, has the expected five entries: GG, LLG, LGL, GLL and LLLL. Singh relies on the 10th-century commentator Yadava, who reads the rule misrau ca as covering beat-counted metres too, so the link to Pingala himself runs through a commentary.

Dates the sources do not agree on

Shah, Divakaran and Singh place the commentator Halayudha in the 10th century, while Kulkarni writes the 13th. For Kedara’s Vrittaratnakara, a later manual that counts by a different method, Kulkarni says about 800 AD and Shah’s table says about 1100 CE. Pingala’s own date, as set out above, depends on whether the family tradition about Panini is accepted.

Where the method went

Shah traces Pingala’s algorithms through about fifteen centuries of Indian works. Divakaran adds that Madhava’s sine series, from about 1400 CE, rests on sums of sums that obey Pingala’s recurrence, a link the texts never state; the Kerala school is the subject of our article on calculus in Kerala. Written place-value numerals and a symbol for zero came centuries after Pingala on Divakaran’s account, and that story is told in India gave the world zero. Sarngadeva’s Sangitaratnakara, of about 1225 CE, widened the method to rhythms with four kinds of beat, druta, laghu, guru and pluta, lasting 1, 2, 4 and 6 units.

Share
Copied!

Sources & further reading

  1. Jayant Shah, A History of Pingala's Combinatorics (Northeastern University)
  2. Amba Kulkarni, Recursion and Combinatorial Mathematics in Chandashastra (University of Hyderabad, 2017 version)
  3. Amba Kulkarni, Recursion and Combinatorial Mathematics in Chandashastra (arXiv math/0703658, first version)
  4. P. P. Divakaran, Pingala and the Beginnings of Combinatorics in India (talk at FPSAC, Bangalore, 21 July 2022)
  5. Subhash Kak, Indian binary numbers and the Katapayadi notation (Annals of the Bhandarkar Oriental Research Institute, vol. 81, 2000)
  6. Subhash Kak, Yamataraja bhanasalagam: An Interesting Combinatoric Sutra (Indian Journal of History of Science, vol. 35, 2000)
  7. Parmanand Singh, The So-called Fibonacci Numbers in Ancient and Medieval India (Historia Mathematica 12, 1985)
  8. Nuh Aydin, Mohammad K. Azarian, Omid Khormali and Ghaya Mtimet, On the History of the Square and Multiply Algorithm (arXiv 2606.00958, version 3, 29 July 2026)

Researched and written with the help of AI tools and edited for accuracy. Provided for general information and discussion only, not professional advice. See our editorial standards and disclaimer. Spotted an error? Tell us.

#pingala#chandahshastra#sanskrit prosody#indian mathematics#combinatorics#binary numbers#fibonacci numbers#ancient india

Enjoyed this? Get the next one.

One good read at a time, straight to your inbox. No spam, unsubscribe anytime.

More in Science & Space
Jyesthadeva's Yuktibhasa, Written in Malayalam Around 1530, Gives Step-by-Step Proofs for the Kerala School's Series for Pi, Sine and Cosine
Proofs are very unusual in an Indian mathematical text, MacTutor notes, and this Kerala book is full of them. It shows how the series were derived, what it says about the planets, and how a British civil servant in Malabar first put it before European scholars.
The 70 Birch-Bark Leaves of the Bakhshali Manuscript Hold Hundreds of Dot Zeros, and Oxford's Latest Dating Puts the Bark of Five Leaves Between 773 and 1032 CE
A labourer found it in 1881, Oxford's lab tested it in two rounds, and the first, famous date for one leaf did not survive the second round. What remains is a working arithmetic book that writes zero as a dot hundreds of times.
The Baudhayana Sulbasutra, About 800 BCE, States the Rope Rule for a Rectangle's Diagonal and Gives the Square Root of 2 Correct to Five Decimal Places
Priests who laid out sacrificial grounds with poles and marked cords wrote their method down in short rules. Here is what those rules say, how the altars were built, and where historians disagree about dates and borrowing.
← all articles