The Katapayadi Number System

By Image: Gallery: archive copy, Public Domain, Link

What’s common between the first verse of Mahabharata and the last verse of Mēlputtūr Nārāyaṇa Bhaṭṭatiri’s Narayaneeyam written in 1586 CE.?

The first verse of adi parva reads

नारायणं नमस्कृत्य नरं चैव नरॊत्तमम देवीं सरस्वतीं चैव ततॊ जयम उदीरयेत

(” Om ! Having bowed to Narãyana and Nara, the most exalted male being, and also to the Goddess Saraswati, must the word Jaya be uttered)

Mēlputtūr Nārāyaṇa Bhaṭṭatiri’s Narayaneeyam ends with the words ayur- ̄arogya-saukhyam. This wishes long life, health, and happiness to the readers of his devotional poem.

The words jayam and ayur- ̄arogya-saukhyam have two properties.

  1. Both have proper meanings in the context of the sentence used (as in, they are not gibberish words.) This matters as we go into the details.
  2. The second property is not well known. Both those words encode a number that has a deeper meaning.

In this system of encoding, jaya represents 18 and ayur- ̄arogya-saukhyam 17,12,210. Counting those many days from Kali Yuga, gives the date as 8th December 1586, the completion date of Narayaneeyam.

This article looks at this style of representing numbers using meaningful words.

Katapayadi Number System

Process-wise, the encoding is simple. Each Samskritam consonant is given a number. Hence the algorithm is as simple as reading it from right to left.

encoding of jaya in katapayadi system

The letter ja is assigned the number 8 and ya, 1. Reading from right to left, it becomes 18.

Why did Vyasa pick on the number 18 and encode it as jaya? Why did he call Mahābhārata as jaya. Mahābhārata has 18 parvas. Gita has 18 chapters. The war was fought for 18 days. There were 18 akshauhini’s in the war. Thus jaya was not a random selection.

Here is the full table of the consonant to number assignment.

ka क കkha ख ഖ
ga ग ഗ
gha घ ഘ
nga ङ ങ
ca च ച
cha छ ഛ
ja ज ജ
jha झ ഝ
nya ञ ഞ
ṭa ट ട
ṭha ठ ഠ
ḍa ड ഡ
ḍha ढ ഢ
ṇa ण ണ
ta त ത
tha थ
da द ദ
dha ध ധ
na न ന
pa प പ
pha फ ഫ
ba ब ബ
bha भ ഭ
ma म മ
ya य യ
ra र ര
la ल ല
va व വ
śha श ശ
sha ष ഷ
sa स സ
ha ह ഹ
katapayadi table

Look at the letters which represent the number 1. ka, ta, pa, ya gives it the name katapayadi (adi in Samskritam means beginning). Vowels meant 0, and vowels followed by a consonant had no value. In the case of compound letters, the value of the last letter was used.

In its land of origin, Kerala, it was known by a different name Paralpperu where paral means seashell and peru name” (astronomical calculations were done using seashells).

Here is another example. The year 2010 is expressed as natanara.

This is because


If you read this backward, you get 2010. An important point is that the letters are not chosen randomly. They mean something. In this case, natanara means “a man (nara) who is an actor ( nata)”. Since there are many possible letters for each number, the mathematician can create a meaningful word from the numbers.

Similarly, ayur- ̄arogya-saukhyam represents 17,12,210 to represent the date of 8 December 1586. Why was the epoch chosen as the beginning of Kali Yuga? It was the popular way of dating events called the Kali-ahargana. Kali-yuga started at sunrise on Friday, 18 February 3102 BCE, and computing the number of days from then was common in planetary calculations.

The fact that Bhaṭṭatiri used this system is not surprising. He was a student of Achyuta Pisharati, a member of the Hindu school of Mathematics from Kerala. This is also an example where it was used in non-scientific work.

Thus the katapayadi system allows the author to represent large numbers using easy-to-remember words. It also has the flexibility to let the author pick an appropriate word for the context and one that fits the meter if it’s a poem.

During the time of Aryabhatta, there were at least three methods of writing numbers. Mathematicians like Varahamihira and Bhaskaracharya used a system called the bhoot samkhya. Aryabhatta, though, invented his own system, which was a new contribution.(The Aryabhata Number System)

Katapayadi number system was primarily used by Hindu mathematicians and astronomers in Kerala. The fact that numbers can be converted to meaningful words that can be strung together helped Malayali mathematicians perform complicated calculations from memory. They computed eclipses, memorized the calculations using words, and committed to memory. This way, there was no dependency on books or tables. This system of memorization was prevalent till around 100 years back.

The book Moonwalking with Einstein talks about various techniques used by the ancients to memorize data. One of the techniques was called memory palace. The katapayadi system looks simpler as the data to commit to memory is that table.

Origins and Spread

If you ask, who started this number system, there are many answers. It’s possible that Vararuchi wrote them in Candra-vakyas in the fourth century. Aryabahata I, who lived 100 years after, was aware of it. It was then popularized in 683 CE in Kerala by Haridatta. ́Sankaranarayana ( 825–900 CE) mentions this name in his commentary on the Laghubhaskarıya of Bhaskara I. Subhash Kak argues that the the system is much older

Though the system originated in Kerala, it spread around India. Though it was well known in the northern part of India, it was not widely used. It spread from Kerala to Tamil Nadu and Pondicherry. That came due to their contact with Nilakanta Somayaji, another mathematician from the Madhava school. In Karnataka, Jains used it in their writing. Orissa has manuscripts that show usage of this system. Aryabhata II used this in the 10th century with some modifications. Bhaskara II used both Bhootsamkya system and Katapayadi system in his works.

This system was not used just in astronomy and mathematics but also in classifying music. For example, the 72 ragas were classified by musicologist Muddu Venkata Makki using the first two letters to indicate the serial number of the Melakartharagam. Thus Kanakangı shows the serial number 1, Rupavatı 12, Sanmukhapriya 56, or Rasikapriya 72.

You are too late if you think this system would help write something like Da Vinci Code. The National-Treasure-in-India script was done a few hundred years back. Ramacandra Vajapeyin, who lived in Uttar Pradesh, used this technique to forecast a dispute or war victory. His brother wrote a text to draw magic squares for therapeutic purposes.

Forgotten Mathematicians

I learned about the Hindu school of Mathematics (as opposed to the Jain school) from Kerala by reading A Passage to Infinity by George Gheverghese Joseph. Though there were few mathematicians in Kerala in the 9th, 12th, and 13th centuries, what is today called the Kerala School started with Madhava, who came from near modern-day Irinjalakuda. His achievements were phenomenal; they included calculating the exact position of the moon and what is now known as the Gregory series for the arctangent, Leibniz series for the pi and Newton power series for sine and cosine with great accuracy.

Some of these techniques were forgotten, but thanks to a renewed interest in Samskritam, there is a revival of knowledge. This whole article was triggered when I read the first chapter of my Samskrita Bharati book on sandhis which mentioned the katapayadi system.


  1. If are you curious to know why Mahābhārata was called jaya, then read this article.


  1. Vijayalekshmy M. “‘KATAPAYADI’ SYSTEM — A CONTRIBUTION OF MEDIEVAL KERALA TO ASTRONOMY AND MATHEMATICS.” Proceedings of the Indian History Congress, vol. 69, 2008, pp. 442–46, Accessed 7 May 2022.
  2. Anusha, R., et al. “Coding the Encoded: Automatic Decryption of KaTapayAdi and AryabhaTa’s Systems of Numeration.” Current Science, vol. 112, no. 3, 2017, pp. 588–91, Accessed 7 May 2022.
  3. Kak, Subhash. “INDIAN BINARY NUMBERS AND THE KAṬAPAYĀDI NOTATION.” Annals of the Bhandarkar Oriental Research Institute, vol. 81, no. 1/4, 2000, pp. 269–72, Accessed 7 May 2022.
  4. Iyer, P. R. Chidambara. “REVELATIONS OF THE FIRST STANZA OF THE MAHĀBHĀRATA.” Annals of the Bhandarkar Oriental Research Institute, vol. 27, no. 1/2, 1946, pp. 83–101, Accessed 7 May 2022.
  5. A. V. Raman, “The Katapayadi formula and the modern hashing technique,” in IEEE Annals of the History of Computing, vol. 19, no. 4, pp. 49-52, Oct.-Dec. 1997, doi: 10.1109/85.627900.

Sanskrit Notes: Why Siddhanta Kaumudi?

(This article requires basic understanding of Samskritam grammar)

Siddhanta Kaumudi

When it comes to Samskritam grammar, the definitive books are Panini’s Ashtadhyayi and Dhatupaatah. Then why do we have so many other books like vartikas, bhashyas and kaumudis. What gap do they address? Specifically, what does a book like Siddhanta Kaumudi adress? To understand that we need to start with the basics and go down in a systematic way.

Let’s start with a simple sentence

गृहतः कार्यालयं गच्छति

When you see this sentence and have no clue about Sanskrit, you will know that, this sentence is made up of three words.

It can split once again by separating the प्रकृति: and प्रत्यय as follows. In each section, the first word is the प्रकृति: and the second, the प्रत्यय

Can this be split even further, like how we can split NaCl into Sodium and Chlorine and then into atoms and other sub-atomic particles? How far can we split the words in Samskritam and what is the end beyond which we cannot split further? In Samskritam, that root is called a धातु. There are approximately around 2000 धातु and 480 प्रत्यय. All the known words are formed by a combination of these.

Samskritam grammar is essentially a reverse engineering of the rules of the spoken language. The language came first and then the grammar. If you are a grammarian, and want to construct the rules of the language, there are two ways of doing it.

  • List the rule for each word. This obviously does not scale. The real world example would like calling the name of each student in the school and asking them to come into the class.
  • Come up with generalized rules which apply to a broad category. Come up with exceptions to those rules. The general rule could be, everyone enter the class and the exception could be – except Rahul. This makes the encoding of the rules simpler and easier to remember.

Samskritam grammar is essentially a reverse engineering of the rules of the spoken language. The language came first and then the grammar. If you are a grammarian, and want to construct the rules of the language, there are two ways of doing it.

  • List the rule for each word. This obviously does not scale. The real world example would like calling the name of each student in the school and asking them to come into the class.
  • Come up with generalized rules which apply to a broad category. Come up with exceptions to those rules. The general rule could be, everyone enter the class and the exception could be – except Rahul. This makes the encoding of the rules simpler and easier to remember.

Panini demonstrated that with just less than 4000 sutras, he could come up with all the rules for all the words in Samskritam. This was possible only because the approach he took was the second one.

Panini’s two books cover this

  • Dhatupatah – covers all the dhatu and their meaning
  • Ashtadhyayi – covers all the प्रत्यय, (Chapters 3, 4, and 5)

The Ashtadhyayi consists of 8 chapters and they cover the following topics

  • 1, 2 – संज्ञा, परिभाषा, समासः, कारकं
  • 3,4,5 – प्रत्ययाः
  • 6, 7, 8 – संधिः, प्रत्ययानां योजनम्

Among the Sanskrit grammarians, the most famous are Panini, Katyayana and Patanjali. Katyayana wrote vartikas (explanatory texts) and Patanjali wrote mahabhashyam (great commentary). The books they wrote are succinct and does not contain examples of the rules. This makes it hard for a student who try to study the grammar.

Then came a second set of books called व्रित्तिग्रन्धा: These books have more details about the sutra, like how to split it, the meaning of these words, examples, clarification of doubts, etc. Among these the famous are काशिकवृत्तिः and प्रथमावृत्तिः These texts follow the same order as the sutras in Ashtadhyayi.

This becomes a problem if you are interested in one topic like समासः. The sutras for these are not together and hence a student following the original texts or the व्रित्तिग्रन्धा: will have to collate the related sutras and figure it out.

To address this issues, there came a type of text called the प्रक्रियाग्रन्धा: These are organized according to topics with everything related to संधिः in one place and everything related to समासः in one place. Famous in this category are रूपावतारः, प्रक्रियाकौमुदि. But these books had some issues and caused confusion. Then Bhattoji Dikshit wrote सिद्धान्तकौमुदि fixing all the issues among the previous books. He explained all the sutras, in the style of प्रक्रियाग्रन्धा:and corrected the issues with the previous books.

(Based on the lecture by Tilak Rao. If you are interested in learning Siddhanta Kaumudi, here is the playlist)

Sanskrit Notes: Order of Words

Rudraksha by Kinshuk Sunil (flickr
Rudraksha by Kinshuk Sunil (flickr)

One of the interesting features of Sanskrit is that, in a sentence, the order of the words don’t matter. You can switch them around and the meaning remains the same.
Take for example a sentence like, Rama is going to the forest. You can’t say, “Rama going forest.” You need the “is” and “to the” to make sense of the sentence. The “is going” indicates that it is one person who is doing the action. Now, “to the forest” indicates that the forest is the object of the action.
In simple Sanskrit, you would write it like this
रामः वानमं गाच्छति
It reads, “Ramah vanam gachati”,  When you say “Ramah”, it indicates one Rama. A forest is “vana”, but in the sentence, we wrote it as “vanam”. That indicates, it is the object of Rama’s destination. The “ti” at the end of “gacchati” indicates that it is one Rama who is going (not two)”. If there were many Ramas, it would have become “gacchanti”. Thus the “is going” and “to the” are built into the words themselves.
This makes it interesting. Now you can write

  • गाच्छति रामः वानमं
  • गाच्छति वानमं रामः
  • वानमं गाच्छति रामः

All these sentences mean the same even though the order of words are switched around. Since each word has the part which maintains its relationship to the verb, the order does not matter. Due to this, in poetry, you can switch words around to fit the meter. In Hindu tradition, almost everything is written in poetry form and this made it easier for an oral society to remember anything forever.
Here is a complicated sentence
भारत ! यदा यदा धर्मस्य ग्लानिः अधर्मस्य अब्युधानं च भवति तदा अहम् आत्मानं सृजामि
Take those words and resequence them and apply the sandhi rules, and you get the following verse from chapter 4 of Gita

यदा यदा हि धर्मस्य ग्लानिर्भवति भारत ।
अभ्युत्थानमधर्मस्य तदात्मानं सृजाम्यहम् ॥४-७॥

Here is an exercise. Try the “Rama is going to the forest” in your mother tongue and see how it behaves. Does it work the same in Dravidian languages and Indo-European languages? In Malayalam, it behaves exactly the same as in Sanskrit. In Hindi, it does not.

  • Based on the lectures of Varun Khanna at Chinmaya International Foundation
  • Gitapravesha by Samskrita Bharati

Three Stage Evolution of Mahabharata – jayam, bharatam, mahabharatam

Mahabharata (via Wikipedia)
Mahabharata (via Wikipedia)

There are clues in Mahabharata which tells us about how the itihaas grew to become the longest poem with over a lakh verses. Mahabharata is divided into 18 parvas with Harivamsha as the 19th. The core of it — around 24, 000 — verses are about the war between the Pandavas and Kauravas. Besides this, there are tales of gods, kings, sages, discourses on philosophy, religion, law and various asramas of life. We know that Vyasa was the composer who taught it to Vaisampayana who then narrated it to Janamejaya at his sarpa yagna. Ugrasravas, the suta, then narrated it to others at Namisharanyam. Recently I read a book — A short history of Sanskrit Literature — which elaborates on a theory on how Mahabaharatam came to be.
Here are three verses from Mahabharata which refers to three different lengths

  • This verse refers to the first stage that has over 8000 verses
    Mahabharata - Reference to ashtau shloka sahasrani or 8000 shlokas
    Mahabharata – Reference to ashtau shloka sahasrani or 8000 shlokas
  • This is the reference to the 24,000 verses
    Mahabharata - chatur vimshati sahasrim - or 24,000 verses
    Mahabharata – chatur vimshati sahasrim – or 24,000 verses
  • This is the reference to the third stage that has over a lakh verses.
    Mahabharata - shata sahasram or 100, 000 shlokas
    Mahabharata – shata sahasram or 100, 000 shlokas

It is not just that the number of verses increased; the name of the itihaas changed as well. The very first line in adi parvam refers to it as jayam.

नारायणं नमस्कृत्य नरं चैव नरॊत्तमम
देवीं सरस्वतीं चैव ततॊ जयम उदीरयेत

Then it became bharatam and finally mahabharatam. Was it because it passed through three people — Vyasa, Vaisampayana, and Ugrasravas?

A short history of Sanskrit Literature, by TK Ramachandra Aiyar
A short history of Sanskrit Literature, by TK Ramachandra Aiyar

The author of the book, T. K. Ramachandra Aiyar, thinks that the core of Mahabharata is the rivalry of Kurus and Panchalas. Their enemosity is historic. They quaralled for a long time and finally there was a union. The Yajurveda — which was composed in a nearby region — mentions this. The Kathaka Samhita, though speaks of a dispute between Vaka Dalbhya from Panchala and a Dritharashtra who is the son of a Vichitravirya, a Kuru. Over time, the kingdoms split again and engaged in constant rivalry. By the time of Mahabharata, the Kuru and Panchala kingdom were separate.
Prior to the war, there was a turn of events which caused the annexation of Northern Panchala by the Kurus. This is the incident, where Drona defeats Drupada using Arjuna. This event upset the balance of poweer between the two kingdoms. The Kurus were defeated in the war and the Panchalas won along with the Pandavas. (Here is an interesting explanation about the Mahabharata war, not as a rivalry between Kauravas and Pandavas, but as a war between Kurus and Panchalas).
With this background, here is the theory on what might have happened. The defeat of the Kurus would have resulted in various songs glorifying the victory of the Pandavas and their allies. Sutas would have sung this in various assemblies. This would have been Jayam. By the second stage, when it reaches 24,000 verses, the life of Pandavas was elaborated. Krishna was represented as an incarnation of Vishnu and Shiva and Vishnu become more prominent than Brahma. The epic became popular all over bharatavarsha and other additions like the stories of gods and sages were added and it became a treatise on dharmashastra. This was the third stage.
The book became an authority on dharma dealing with religion, law and morality. It was accorded the status of the 5th veda. There are land grants dating between 462 CE and 532 CE, which talks about the one-lakh verse Mahabharatam compiled by Vyasa. There are numerous literary evidence from Sanskrit authors on the stature of Mahabharata. From Ujjayini to Khamboja, the ithihaas was read in temples. It became a national epic.

Sanskrit Notes: Tenses

Learning Sanskrit by Avanish Tiwary (Flickr)
Learning Sanskrit by
Avanish Tiwary (Flickr)

Like any language, Sanskrit has the three tenses: the present, past and future. They are called वर्तमानकालः, भूतकालः and  भविष्यत्कालः respectively. For the present tense, there is just one way of saying it. In Sanskrit grammar, it is called लट् लकार.
When we look at the past and the future it gets interesting. There is more than one way of representing the future or there are two लकार.

  1. लृट्- Commonly used for future tense
  2. लुट् – is used to represent अनद्यतन events which means any event that did not happen today. Used to refer to events happening tomorrow and after. Thus technically you cannot say,रामः  शवः वनं गमिष्यति. The correct version is रामः  शवः वनं गन्ता

When it comes to the past, there are three ways

    1. लङ्घ् – अनद्यतन भूतकालम means, the event did not happen today.
    2. लुङ्ग् – Used commonly
    3. लिट् – It happened, but I did not see it with my own eyes