## What are some mind blowing facts about Sanskrit?

Encrypting the value of pi in a shloka.

There is a numbering system in Sanskrit called the Katapayadi system. This system ascribes a number to every letter or alphabet in the script, something similar to the ASCII system in computer science. When the letter in the following shloka is replaced with their corresponding number from the Katapayadi Sankhya, we get the value of pi accurate to 31 digits.

गोपीभाग्यमधुव्रात-शृङ्गिशोदधिसन्धिग ।
खलजीवितखाताव गलहालारसंधर ॥
OR

Khalajivitakhatava galahalarasandhara||

(The shloka extolls Krishna and his achivements.)

I have verified the above for the first few numbers from the wiki article of the Katapayadi Sankhya, and I thought it was a very cool bit of encryption.

Edit from the comments section( thanks to R. Shreevatsa):

For an idea of what’s involved here, note that the Kaṭapayādi system dictates that:
* As the first digit is 3, the first consonant must be one of ga, ḍa, ba, la
* As the second digit is 1, the second consonant must be one of ka, ṭa, pa, ya
* For the third digit to be 4, the third consonant must be one of gha, ḍha, bha, va…

So to fit 3.141592653589793…, the list of consonants in the verse must satisfy the regex
{g,ḍ,b,l}{k,ṭ,p,y}{gh,ḍh,bh,v}{k,ṭ,p,y}{ṅ,ṇ,m,ś}{jh,dh}{kh,ṭh,ph,r}{c,t,ṣ}{ṅ,ṇ,m,ś}{g,ḍ,b,l}{ṅ,ṇ,m,ś}{j,d,h}{jh,dh}{ch,th,s}{jh,dh}{g,ḍ,b,l}…
(where the choices actually made I’ve marked in bold), with vowels and half-consonants added as desired: