# Indian binary numbers and the Katapayadi notation

Van Nooten has well summarized^{1} the description of binary numbers by Piṇgala Nāga in his Chandaḥśāstra^{2}, here represented by CS. According to an old Indian tradition, Piṇgala was the younger brother of Pāṇini. This is so stated by śadguru-śiśya in his Vedārtha Dīpikā. If this tradition is correct^{3}, he should be assigned to the 5th century BC, the most likely period of Pāṇini’s life.^{4}

It has not been recognized that Piṇgala’s Chandaḥśāstra can throw light on the long controversy regarding the age of the Kaṭapayādi (KTPY) notation of representing numerals as letters of the alphabet. The earliest attested date for it appears to be a text by Bhāskara I belonging to the 7th century AD. ^{5} Although many scholars have argued that the KTPY scheme goes as early as Vararuci and its earliest use should belong squarely in the centuries BC, they have not been able to provide an unambiguous usage which is that early. The object of this note is to provide that early evidence of a form of the KTPY scheme.

### Triplets of syllables

Sanskrit metres are based on the system of short, *laghu*, and long, *guru*, syllables, represented here by 1 and 0. Classification schemes for metres go back very early, to the early Vedic age and their great significance in Vedic thought may be gleaned from the extensive, recurring discussion of them in the Satapatha Brāhmanṇa (e.g. SB 8.6.2). Metres of different lengths are described. In CS two basic classifiatory schemes for metres are presented. One of them is direct and it represents a regular binary number mapping; the other represents a metre in terms of groups of three syllables, which is really an octal representation of numbers. Aitareya Brāhmanṇa 3.28 says that originally the triṣṭubh, one of the most important of the metres, was 3-syllabic, and this cryptic remark may indicate the great antiquity of the octal representation.

Piṇgala gives the following representation for the verse- feet (CS, Adhyāya 1):

Strictly speaking, each of the letters should be written together with the vowel a, asin ma for 000. Note further, that the 8 sequences fall into two complementary subclasses when 0s and 1s are interchanged. Thus m, y, r, s are in one group and t, j, bh, n are in another.

The mapping of Table 1 represents a binary number coding of the 3-syllables excepting that the order of the bits is reversed from our modern representation, so the bit on the left is the least significant and the one on the right is the most significant. We also note, parenthetically, that rather than rank the sequences from 0 to 2^{n} – 1, they were ranked from 1 to 2^{n}, but this was done by adding 1 to the computed numerical value for each sequence. But this process made it clear that Piṇgala understood perfectly the binary number system which maps the numbers from 0 on, as has been explained by van Nooten.

### More on the KTPY scheme

Now from Piṇgala to the KTPY mapping which is known in four basic variants. The most commonly used KTPY scheme is as shown below:

Comparing the Piṇgala assignment of Table 1 with the standard KTPY scheme of Table 2, we see that there exists fundamental similarity in the two schemes, the differences being a switch between the p- and the s- groups and that the numbers above 3 have been mapped rather irregularly.

Below we give our construction of the mapping behind the Piṇgala scheme which, in analogy with Kaṭapayādi, may be called Kaṭayaśādi and for compactness we will call it KTYS.

The mapping of the numbers 0, 1, 2, 3 in Table 1 is according to this scheme. Since the basic mapping is in groups of 5, Piṇgala had to make adaptation to apply it to his 8 numbers. The complements of the first four sequences were mapped to 6, 8, 9, and 0; in other words, columns 4, 5 and 7 were left unused. Given that in such a mapping two columns had to be left unused, the only matter of significance is why column 0 was assigned to sequences 0 and 7 at the same time. It appears that was done to suggest that sequence 7, the largest number in the set, was akin to the largest number in the set.

It is possible that Piṇgala modified the standard KTPY mapping to the variant form of Table 3 because two letters, g and l, were already assigned to the guru and laghu syllables. Since g or l for 3 were unavailable, and not wishing to use the cerebral d ., Piṇgala was obliged to develop a new mapping.

Note that the Table 3 is used with some symmetry where the 6 outer columns are used, along with one of the middle ones. If one were to consider the 5-groups Sanskrit alphabet, the assignment from the groups is in the frequency of 2, 1, 2, 1, 2: the first column supplying t, y; the second, r; the third, j, s; the fourth, bh; and the fifth, m, n. Maybe, this symmetry was another consideration that led to Table 1.

### Concluding Remarks

The systematic manner in which Piṇgala chose his mapping throws important light on the history of the Kaṭapayādi mapping. It is almost certain that the variant KTYS existed around his time, as might have other variants, including KTPY, as well. This takes the history of the KTPY mapping more than a thousand years earlier than had been supposed.

### Notes

- van Nooten, B., “Binary numbers in Indian antiquity”,
*Journal of Indian Philosophy*, 21, 31-50, 1993; reprinted in Rao, T.R.N. and Kak, S. (eds.), Computing Science in Ancient India. USL Press, Lafayette, 1998. - Weber, A.
*Ueber die Metrik der Inder*. Ferd . Dummler’s Verlagsbuchhandlung, Berlin, 1863; this contains the 4 text of Piṇgala’s Chandaḥśāstra . - Shrava, Satya,
*A Comprehensive History of Vedic Literature*. Pranava Prakashan, New Delhi, 1977. - Agrawala, V.S..
*India as Known to Pāṇini*. University of Lucknow, Lucknow, 1953. - Raman, A.V., “The Katapayadi formula and the modern hashing technique”, IEEE Annals of the History of Computing, 19, 49-52, 1997; reprinted in Rao and Kak (1998), cited above.

*This article first appeared in Annals of the Bhandarkar Oriental Research Institute, vol. 81, 2000, pp.269-272 and has been republished with permission from the author*

*Featured Image: Quora
*