Naṣṭa: An ingenious algorithm by Piṅgala

Share now!

By Soorya Narayan

India has been a cradle not only to refined civilizational best-practices but also to multitudinous scientific developments. Evidence and knowledge of voluminous literature produced in Indian scientific pursuits has been well established by serious researchers. In contrast, there is prevalent ignorance about facts and feats that we have inherited. 

Through a series of short articles, we have set forth to cover a few highlights in the development of Jyotiṣa (Astronomy) and Gaṇitā (Mathematics). The development of both these fields can broadly be put in three eras: 

  • Vedic or Pre-Siddhantic Era, 
  • Siddhantic or Classical Era and  
  • Post-Siddhantic or Medieval  Era. 

Having delved into the Vedic period, we have moved ahead in the timeline and presented an introductory glimpse into the phenomenal breakthroughs in Chandas-śāstra was composed by Piṅgala-nāga around 3rd century BCE.  In his chapter eight of Chandas-śāstra, Piṅgala introduces some combinatorial tools called pratyayas which can be employed to study the various possible metres in Sanskrit prosody. The algorithms presented by him form the earliest examples of use of recursion in Indian mathematics. In the previous editions of Parnika, we looked at the algorithm given for Prastāra and Saṅkhyā. In the current article we shall delve more into further interesting algorithms or pratyayas enunciated by Piṅgalācārya.

Algorithm#3 ~ Naṣṭa

Piṅgalācārya presents the the third of the six pratyayasNaṣṭa for finding the sequence of the metrical pattern in a given n-syllable prastāra (ordered sequence of all combinations, as explained in algorithm 1 in previous articles) . 

The following sūtras correspond to the procedure of deducing the Naṣṭa.

लर्घे। सैके ग्।

(छन्दःशास्त्रम् ८.२४-२५)


This algorithm is explained astonishingly in the most concise way possible! The steps presented here in these two
sūtras imply essentially the following:

  • To find the metric pattern in a row of the prastāra, start with the row number
  • Halve that number (if possible) and write an L
  • If it cannot be halved perfectly, add one to the number, then halve that value and write a G
  • Repeat the above two steps till all the syllables of the meter are found

This is one among the most elegant representation of the algorithm. To illustrate we shall consider the following example: May we employ the Naṣṭa algorithm to find the 132nd metrical form in the prastāra (ordered sequence of all combinations) of an 8-syllabled meter.

  • 132 is divisible by 2, so perform 132 ÷ 2 and mark “L”
  • 66 is divisible by 2, so perform 66 ÷ 2 and mark “L”
  • 33 is not divisible by 2, so perform (33+1) ÷ 2 and mark “G”
  • 17 is not divisible by 2, so (17+1) ÷ 2 and mark “G”
  • 9 is not divisible by 2, so (9+1) ÷ 2 and mark “G”
  • 5 is not divisible by 2, so (5+1) ÷ 2 and mark “G”
  • 3 is not divisible by 2, so (3+1) ÷ 2 and mark “G”
  • 2 is divisible by 2, so 2 ÷ 2 and mark “L”

Now we have the combination “LLGGGGL”. In the ordered list of an 8-syllabled meter, this combination would be the 132nd metrical form in the prastāra.

It is indeed enthralling to know in depth about the rich scientific heritage of the Indian civilization. We shall continue to see the other ingenious algorithms or pratyayas enunciated by Piṅgalācārya in the following editions.

Aum Tat Sat!