top of page

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

By Soorya Narayan

India has been a cra­dle not only to refined civ­i­liza­tion­al best-prac­tices but also to mul­ti­tudi­nous sci­en­tif­ic devel­op­ments. Evi­dence and knowl­edge of volu­mi­nous lit­er­a­ture pro­duced in Indi­an sci­en­tif­ic pur­suits has been well estab­lished by seri­ous researchers. In con­trast, there is preva­lent igno­rance about facts and feats that we have inher­it­ed.

Through a series of short arti­cles, we have set forth to cov­er a few high­lights in the devel­op­ment of Jyotiṣa (Astron­o­my) and Gaṇitā (Math­e­mat­ics). The devel­op­ment of both these fields can broad­ly be put in three eras:

  1. Vedic or Pre-Sid­dhan­tic Era,

  2. Sid­dhan­tic or Clas­si­cal Era and

  3. Post-Sid­dhan­tic or Medieval Era.

Hav­ing delved into the Vedic peri­od, we have moved ahead in the time­line and pre­sent­ed an intro­duc­to­ry glimpse into the phe­nom­e­nal break­throughs in Chan­das-śās­tra was com­posed by Piṅ­gala-nāga around 3rd cen­tu­ry BCE. In his chap­ter eight of Chan­das-śās­tra, Piṅ­gala intro­duces some com­bi­na­to­r­i­al tools called pratyayas which can be employed to study the var­i­ous pos­si­ble metres in San­skrit prosody. The algo­rithms pre­sent­ed by him form the ear­li­est exam­ples of use of recur­sion in Indi­an math­e­mat­ics. In the pre­vi­ous edi­tions of Parni­ka, we looked at the algo­rithm giv­en for Prastāra and Saṅkhyā. In the cur­rent arti­cle we shall delve more into fur­ther inter­est­ing algo­rithms or pratyayas enun­ci­at­ed by Piṅ­galācārya.

Algorithm#3 ~ Naṣṭa

Piṅ­galācārya presents the the third of the six pratyayas — Naṣṭa for find­ing the sequence of the met­ri­cal pat­tern in a giv­en n‑syllable prastāra (ordered sequence of all com­bi­na­tions, as explained in algo­rithm 1 in pre­vi­ous arti­cles) .

The fol­low­ing sūtras cor­re­spond to the pro­ce­dure of deduc­ing the Naṣṭa.लर्घे। सैके ग्।

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

This algo­rithm is explained aston­ish­ing­ly in the most con­cise way pos­si­ble! The steps pre­sent­ed here in these two sūtras imply essen­tial­ly the fol­low­ing:

  1. To find the met­ric pat­tern in a row of the prastāra, start with the row num­ber

  2. Halve that num­ber (if pos­si­ble) and write an L

  3. If it can­not be halved per­fect­ly, add one to the num­ber, then halve that val­ue and write a G

  4. Repeat the above two steps till all the syl­la­bles of the meter are found


This is one among the most ele­gant rep­re­sen­ta­tion of the algo­rithm. To illus­trate we shall con­sid­er the fol­low­ing exam­ple: May we employ the Naṣṭa algo­rithm to find the 132nd met­ri­cal form in the prastāra (ordered sequence of all com­bi­na­tions) of an 8‑syllabled meter.

  1. 132 is divis­i­ble by 2, so per­form 132 ÷ 2 and mark “L”

  2. 66 is divis­i­ble by 2, so per­form 66 ÷ 2 and mark “L”

  3. 33 is not divis­i­ble by 2, so per­form (33+1) ÷ 2 and mark “G”

  4. 17 is not divis­i­ble by 2, so (17+1) ÷ 2 and mark “G”

  5. 9 is not divis­i­ble by 2, so (9+1) ÷ 2 and mark “G”

  6. 5 is not divis­i­ble by 2, so (5+1) ÷ 2 and mark “G”

  7. 3 is not divis­i­ble by 2, so (3+1) ÷ 2 and mark “G”

  8. 2 is divis­i­ble by 2, so 2 ÷ 2 and mark “L”

Now we have the com­bi­na­tion “LLGGGGL”. In the ordered list of an 8‑syllabled meter, this com­bi­na­tion would be the 132nd met­ri­cal form in the prastāra.

It is indeed enthralling to know in depth about the rich sci­en­tif­ic her­itage of the Indi­an civ­i­liza­tion. We shall con­tin­ue to see the oth­er inge­nious algo­rithms or pratyayas enun­ci­at­ed by Piṅ­galācārya in the fol­low­ing edi­tions.

Aum Tat Sat!

Recent Posts

See All

The Indian Decimal Place Value System

Indi­a’s Inspir­ing Sci­en­tif­ic Her­itage A primer series into the devel­op­ment of Jyotiṣa & Gaṇitā in India Through a series of short arti­cles, we have set forth to cov­er a few high­lights in th

bottom of page