A poem or a verse consists of a number of syllables, some stressed (or long), and others unstressed (or short). These syllables can be arranged into a number of different patterns which give rise, in the case of poetry, to different meters or, in the case of music, to different rhythms. Several Sanskrit scholars have devoted their talents to the study of meter and rhythm.
The word for meter in Sanskrit is chhanda. For example, readers familiar with the Bhagavad Gita will recall that in the 10th chapter, the chapter on Vibhuti Yoga, Lord Sri Krishna calls the Gayatri chhanda as His vibhuti among the chhandas. A commonly found chhanda in Sanskrit is the Anushtup chhanda. For example, the following verse from the Bhagavad Gita is in the Anushtup chhanda:
(The unreal has no existence while the real never ceases to be. This has been perceived by knowers of the truth.) Another commonly found meter is the upajati chhanda. Another example, again from the Bhagavad Gita, is
(As one casts away worn out clothes and takes on new clothes, so also the soul casts away old and worn out and takes on new ones.)
Due to the infinite numbers of possible permutations and combinations, an infinite number of chhandas and rhythms are possible. The study of these meters is called prosody. Creating algorithms to classify and arrange these meters, as well as to generate new meters, forms a major part of the work of the Sanskrit prosodists. As a consequence, there are hundreds of Sanskrit chhandas categorized and classified, while only a dozen or so meters are identified in English poetry. The meters used in Sanskrit poetry often form the base for the corresponding rhythms, and as a result the art of rhythm is developed to such a high degree of sophistication in Indian classical music.
In their quest for studying meters and rhythm, the Sanskrit prosodists created complex algorithms using iterative and recursive techniques ( techniques which are commonly used in computer science) which has had a huge impact on the development of modern day computer science. In the process, they made several important mathematical discoveries predating their appearance elsewhere in the world by centuries. Probably the most well known Sanskrit prosodist is Pingala (450 or 200 BC), who wrote his treatise called the chhanda sutra (sutras on the chhanda). In this treatise, he obtained the result which is today known as the binomial theorem for integral index, which in modern notation is expressed as
Where nCr is :
The discovery of the binomial theorem today is credited to Newton, although it was discovered by Pingala several centuries earlier. (see  for the binomial theorem and Pingala.)
In the context of the above result, he also described the following triangle of numbers, in which any number is the sum of the two numbers above and to the right and left of it:
The triangle offers a very convenient means of writing (x+y)n without calculating nCr in Eqn. (1). For example, if we want (x+y)5, then we just look at the 5th row of the Meru Prastara, and the numbers in this row, 1, 5, 10, 10, 5, 1, immediately give us the answer:
Pingala called the above triangle as Meru Prastara. Meru is a mountain which appears frequently in Sanskrit literature.
Today the Meru Prastara is called Pascal’s triangle even though it was discovered several centuries earlier.
Here we note an interesting fact about the Meru Prastara. If we add these numbers as shown in the figure above, we get the sequence of numbers (mentioned in Prakrta Paingala – early 14th century, as mentioned in R. W. Hall’s Math for poets and drummers):
Note that each number is the sum of the preceding two. This sequence of numbers forms the well known Fibonacci sequence, even though it was discovered by Indian mathematicians years earlier. For example, these numbers and the rule for obtaining them are described in the works of Virahanka (7th century), Gopala (1135), and Hemachandra (1089-1172). In particular, Hemachandra posed the question: “If a long syllable is twice as long as a short syllable, in how many ways can a line of n time units be created?”, and showed that the answer is the n+1th term in the sequence. Thus, due to their precedence in discovery, a more proper name would be the Hemachandra numbers, at least in India.
There is a close connection between prosody and linguistics, the study of language and grammar. This is because prosody is intimately connected to poetry and literature, and literature is of course intimately connected with the structure and grammar of a language. Therefore it is not surprising that many prosodists were accomplished linguists as well. Probably the most well known linguist of India is Panini, who was born in Pushkalavati (now in Pakistan), and lived in the 4th century BC. The beauty of Panini’s work, the most famous of which is the Ashtadhyayi, is that its study of grammar is independent of language, and hence several modern day linguists and computer scientists have been deeply influenced by his work. There are deep similarities between Panini’s work and the works of modern day linguists and computer scientists such as Leonard Bloomfield, Zellig Harris, Axel Thue, Emil Post, AlanTuring, Noam Chomsky, and John Backus. In computer science, the notation technique known as the Backus Naur form, which is used by most computer programming languages, was described by Panini around 2,500 years earlier ago. It actually ought to be called the Panini-backus form, as suggested by Peter Zilahy Ingerman . The figure below shows the short article in the communications of the ACM (Association for Computing Machinery):
Pingala and Bhatt anticipated the development of the binary number system. The normal decimal to binary conversion procedure is quite similar to Pingala’s algorithms relating to meters (quoted directly from R.W.Hall’s math for pets and drummers). In many ways Panini was the first computer scientist with the software but without the hardware. The Indian government issued a postal stamp in honor of Panini.
Literature, language, linguistics, prosody, mathematics, poetry – all are separated into different watertight compartments in today’s world, held together by an artificial, synthetic unity. However in the ancient Indian knowledge, they all blend seamlessly into one another and are held together by a unity which is integral to the knowledge system itself. This unity gave rise to highly accomplished knowledge not just in the field being investigated, but also in other, seemingly unrelated fields.
 The Golden Mean and the physics of aesthetics, Subhash Kak, Archive of Physics: physics/0411195 (2004)
 Rachel W. Hall, Math for poets and drummers
 Being different, Rajiv Malhotra
 A. K. Bag, "Binomial theorem in ancient India", Indian Journal of History of Science, 1966. (click here for online access.)
 Peter Zilahy Ingerman, "Panini Backus form suggested", Communications of the ACM, 1967. (click here for online access; a subscription will be required for the pdf file.)