Katapayadi Background:

Ka·ṭa·pa·yā·di (Devanagari: कटपयादि), a system of numerical notation, is an ancient Indian alphasyllabic numeral system to depict letters to numerals for easy remembrance of numbers as words or verses.
Assigning more than one letter to one numeral and nullifying certain other letters as valueless, this system provides the flexibility in forming meaningful words out of numbers which can be easily remembered.
The oldest available evidence of the use of Kaṭapayādi (Sanskrit: कटपयादि) system is from Grahacāraṇibandhana by Haridatta in 683 CE. It has been used in Laghu·bhāskarīya·vivaraṇa written by Śaṅkara·nārāyaṇa in 869 CE.
A reasonable estimate for the origin of the Kaṭapayādi system is sometime in the early first millennium. Aryabhata, in his treatise Ārya·bhaṭīya, is known to have used a similar, more complex system to represent astronomical numbers.
Melodic Structures in Indian Classical Music (Ragas):

A raga is a pattern of notes having characteristic intervals, rhythms, and embellishments, used as a basis for improvisation. There are different types of swara sthayis or note pitches that leads to the total number of melakartha ragas. These melakartha ragas have all 7 swaras or [notes] in their scales (only one of each swara, Sa, Re, Ga, Ma, Pa, Dha, Ni), following strict ascending and descending scales and are sung in all octaves. These different variations of swaras leads to more than one combination of musical scale. The melakarta ragas of the Carnatic music is named so that the first two syllables of the name will give its number. This system is sometimes called the Ka-ta-pa-ya-di sankhya. Each has its own unique number, which is mathematically derived from its name, using the katapayadi sankhya to the left.
Janya ragas are ragas that are derived from Janaka ragas (Melakarta ragas). They may have less than 7 notes in their scales, or have additional notes in them, zig-zag (vakra) notes that step and down, asymmetrical scales, etc. (Source: Wikipedia)
Raga/Janyam Classifying Code:
A sequence of swaras/notes that does not conform to the structure of a melakartha raga can be read by this set of code to identify its parent raga: Link to Janyam Finder Code
Here is code that uses the katapayadi sankhya to convert a sequence of swaras to an index to the list of melakartha ragas: Link to Raga Finder Code
The identification is achieved by computing the similarity between the input sequence, and each of the melakartha ragas.

