The Chandaḥśāstra is a work of eight chapters in the late
Sūtra style, not fully comprehensible without a commentary. It has been dated to the last few centuries BCE.[5][6] In the 10th century CE,
Halayudha wrote a commentary elaborating on the Chandaḥśāstra. According to some historians
Maharshi Pingala was the brother of
Pāṇini, the famous
Sanskrit grammarian, considered the first
descriptive linguist.[7] Another think tank identifies him as
Patanjali, the 2nd century CE scholar who authored Mahabhashya.
Combinatorics
The Chandaḥśāstra presents a formula to generate systematic enumerations of
metres, of all possible combinations of
light (laghu) and heavy (guru) syllables, for a word of n syllables, using a recursive formula, that results in a partially ordered
binary representation.[8] Pingala is credited with being the first to express the
combinatorics of
Sanskrit metre, eg.[9]
Create a syllable list x comprising one light (L) and heavy (G) syllable:
Repeat till list x contains only words of the desired length n
Replicate list x as lists a and b
Append syllable L to each element of list a
Append syllable G to each element of list b
Append lists b to list a and rename as list x
Possible combinations of Guru and Laghu syllables in a word of length n[10]
Word length (n characters)
Possible combinations
1
G L
2
GG LG GL LL
3
GGG LGG GLG LLG GGL LGL GLL LLL
Because of this, Pingala is sometimes also credited with the first use of
zero, as he used the
Sanskrit word śūnya to explicitly refer to the number.[11] Pingala's binary representation increases towards the right, and not to the left as modern
binary numbers usually do.[12] In Pingala's system, the numbers start from number one, and not zero. Four short syllables "0000" is the first pattern and corresponds to the value one. The numerical value is obtained by adding one to the sum of
place values.[13] Pingala's work also includes material related to the
Fibonacci numbers, called mātrāmeru.[14]
^Plofker (2009), pages 54–56: "In the Chandah-sutra of Pingala, dating perhaps the third or second century BC, [...] Pingala's use of a zero symbol [śūnya] as a marker seems to be the first known explicit reference to zero. ... In the Chandah-sutra of Pingala, dating perhaps the third or second century BC, there are five questions concerning the possible meters for any value “n”. [...] The answer is (2)7 = 128, as expected, but instead of seven doublings, the process (explained by the sutra) required only three doublings and two squarings – a handy time saver where “n” is large. Pingala’s use of a zero symbol as a marker seems to be the first known explicit reference to zero."
Klaus Mylius, Geschichte der altindischen Literatur, Wiesbaden (1983).
Van Nooten, B. (1993-03-01). "Binary numbers in Indian antiquity". Journal of Indian Philosophy. 21 (1): 31–50.
doi:
10.1007/BF01092744.
S2CID171039636.