My book on Hindu Mathematics The Imperishable Seed: How Hindu Mathematics Changed the World and Why This History Was Erased, is available at https://garudabooks.com/the-imperishable-seed
Introduction
I have discussed in detail in my book The Imperishable Seed: How Hindu Mathematics Changed the World and Why This History Was Erased how the consideration of poetic meters with a fixed number of time units and consisting of only two types of syllables led to the development in the Hindu civilization of the first ever known instance of the so-called Fibonacci numbers anywhere in the world, much before Fibonacci; the two types of syllables in this case being “long” and “short” (Kamble 2022). A long syllable is twice as long as a short syllable and consists of two matras while a short syllable consists of only one matra. Hence, a matra can be understood as a time unit. Also, a long syllable is called guru and a short is called laghu. Such poetic meters, with a fixed number of matras, are called matravrittas.
Poetic meters can also consist of a fixed number of syllables instead of a fixed number of matras. Such meters are called varnavrittas. Both these constitute the two main types of poetic meters (or chhandas) considered in works on prosody in the Hindu civilization. Some considerations which received a great deal of attention in Hindu texts are the following: Which all poetic meters, and how many of them, are possible for a given type of meter. In my book I’ve discussed how these considerations for poetic meters of the varnavrittas type led to the meruprastara (erroneously known as the Pascal’s triangle). Other considerations which also received attention were enumerating the different meters in a specific sequence, indexing the meters, and obtaining the meter from the index and vice versa. As I have discussed in my book, these considerations in the case of varnavritti meters led to the development of the first ever binary system of representing numbers anywhere in the world. The process of generating a meter from its index is called nashtam and the reverse process, namely, that of generating the index from the meter is called uddishtam. The reason behind the names of the algorithms is also discussed in my book.
What about meters of the matravritta type? Well, as I have also discussed in my book, the question of the number of possible meters of the matravritta type for a given number of matras led to the so-called Fibonacci numbers for the first time anywhere in the world. In the process, an algorithm for creating and sequencing all the possible meters is also given, with a corresponding index for each meter in the sequence. For varnavritta meters we saw that the relation between the index and the meter by the nashtam and uddishtam algorithms led to the binary system. The algorithm for conversion was given by Pingala. The question now arises, do similar algorithms exist for converting the index to the meter and vice verse for meters of the matravritta type, i.e. do corresponding uddishtam and nashtam algortihms for matravritta meters exist?
Well, it turns out, yes. The matravritta meters also have the corresponding uddishtam and nashtam algorithms. In fact, this was explained in the same paper by P. Singh, where he had discussed the so-called Fibonacci sequence in the context of matravritta meters (Singh 1985). But the explanation in his paper was a bit obscure and itself needed some figuring out. I finally found the time to do so in the eight hour flight from Frankfurt to Delhi. The method is given in the Prakrit Pingala, a text dated to the first quarter of the 14th century CE. It’s a very clever and neat method and is certainly deserving of a wider audience. Hence I’ll recount the steps in this article. I haven’t got round to figuring out why it works, but if anybody has done it feel free to post in the comments.
First of all it is important to recognize the sequence in which matravritta meters are arranged. In the following we will denote long syllables with a G (for guru) and short syllables with an L (for laghu) – please do not confuse the “L” with “long”! Let us say we want to list out all the matravritta meters with just one time unit. There is only one possibility, and that is clearly L which we list out below:
L
For matravritta meters with two matras, we have the two possibilities:
G
LL
For matravritta meters with three matras, we have the possibilities:
LG
GL
LLL
Note how the meters with 3 matras are built by adding a G to the meters with 1 matra (in this case only L) and an L to the meters with 2 matras (in this case G and LL).
Proceeding in this fashion, we see that for six matras, the following 13 meters are possible:
GGG
LLGG
LGLG
GLLG
LLLLG
LGGL
GLGL
LLLGL
GGLL
LLGLL
LGLLL
GLLLL
LLLLLL
Again, note how these are built by adding a G to all the meters with 4 matras (the first five, given by GG, LLG, LGL, GLL and LLLL), and the last eight by adding an L at the end of all the meters with 5 matras (the next eight: LGG, GLG, LLLG, GGL, LLGL, LGLL, GLLL and LLLLL). Similarly, the meters with 5 matras are obtained by adding a G to all the meters with 3 matras, and an L to all meters with 4 matras, and so on. Obviously, this principle holds for arbitrary number of matras, and this is the order that we will follow for sequencing and indexing the meters.
At this stage it’ll be useful to write a small script to generate these meters instead of doing them manually. Here’s a recursive function written in Python which does exactly that: it sees how many matras are required, then adds an L to all the meters with matras one less than the required matras and a G to all the meters with matras two less than the required matras. The meters with one matra less and two matras less are found again in the same way recursively, till the function reaches 1 and 0, which are defined in the function under the two if-statements.
This way of generating and ordering the chhandas also implies that the number of chhandas with n matras equals the sum of the number of chhandas with n – 2 units and the number of chhandas with n – 1 units, i.e. the famous recursion relation:
S(n) = S(n-1) + S(n-2)
The above function returns a list of all the chhandas with n number of matras in the order we mentioned earlier. Note the recursive nature of the function in the final return-statement, where the function invokes itself. The output can be seen with a print statement. Here is a list of all meters with 6 matras generated by the script:
Having done so, we can now start enunciating the steps for the uddishtam and nashtam algorithms for matravritta meters.
The nashtam for matravritti meters
In the nashtam algorithm, the chhanda corresponding to a given index is to be found. In other words, given the index, find the meter (chhanda). Suppose we are considering all matravritta meters with n matras and we want the meter that corresponds to the mth index. The steps proposed in the algorithm in Prakrit Paingala go as follows:
1. Subtract m from the the nth term of the Virahanka-Hemachandra sequence (1, 2, 3, 5, 8, 13,…). Call it r.
2. If the n – 1 th term of the Virahanka-Hemachandra sequence is smaller than r, subtract the former from r. The new remainder is the new value of r.
If not, do nothing. r remains unchanged.
3. Repeat the same step with the n – 2 th term and r as obtained in the previous step. Assign a new value to r, or leave it unchanged, depending on the case.
4. Go on in this way till you reach the first term of the Virahanka-Hemachandra sequence.
5. For each of the above steps place an L. Now start working backwards from the last step. Note the positions where the subtraction has occurred. Replace the laghus (L) at these positions with a G, and strike off the L at the previous position. The resulting meter, read from the bottom, is the required meter.
Let’s do an example for n = 10, and let’s find the 20th meter, i.e. m = 20.
The sequence is: [1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
1. 89 – 20 = 69; r = 69.
2. 69 – 55 = 14; r = 14. G
3. 14 – 34 < 0; r unchanged. L
4. 14 – 21 < 0; r unchanged.
5. 14 – 13 = 1; r = 1. G
6. 1 – 8 < 0; r unchanged. L
7. 1 – 5 < 0; r unchanged. L
8. 1 – 3 < 0; r unchanged. L
9. 1 – 2 < 0; r unchanged.
10. 1 – 1 = 0; r = 0. G
The subtractions occur at steps 10, 5 and 2, where we have put a G in the above and struck off the L at the previous step. Thus the resulting meter is GLLLGLG.
We can check this with our script:
As we can see, the 20th meter is indeed GLLLGLG. (To save space, I have truncated the output to show only the first 23 meters, otherwise there are 89 meters in total.)
The uddishtam for matravritti meters
This can be summarized as: given the meter, find the index. The algorithm proceeds as follows:
1. Write out the given meter. One by one write the terms of the sequence above and below the syllables in the following way:
2. Write the first term of the sequence (i.e. 1) above the first syllable. If this is G, write the second term below it as well.
3. Write the next term of the sequence above the next syllable. If this is G, write the following term of the sequence below it as well
4. Continue till all the syllables of the meter are exhausted.
5. Add all the numbers over the gurus and subtract the sum from the nth term of the sequence. The answer is the index of the given meter.
Here is an example:
Let us take meters with 10 syllables. As we saw in the previous section, the meter GLLLGLG has 20 as the index. Let’s take this meter so we can verify the answer. The first 10 terms of the Virahanka-Hemachandra sequence are: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89. Write out the meter and write the terms of the sequence as described in the above algorithm. This gives us:
Now add all the numbers over the G’s. This gives 1 + 13 + 55 = 69.
Subtracting this from the nth term i.e. 89, we get 20:
89 – 69 = 20.
And this is the index of the meter (as we already know).
References:
Kamble, Bhaskar. The Imperishable Seed: How Hindu Mathematics Changed the World and Why This History Was Erased. Garuda Publications, 2022.
Singh, Paramanand. The so-called Fibonacci Numbers in Ancient and Medieval India. Historia Mathematica 12 (1985) 229-244.
I highly recommend this book to all. It's written in a very easy to read language but still maintains the integrity of citing sources. Reminds me of a new era of books by giants like Datta and SIngh, Yadav and Mohan et al. This one proudly sits on my bookshelf and gets referenced quite often. A very, very good and comprehensive coverage of History of Indian Mathematics.