A Sanskrit grammatical problem which has perplexed scholars since the 5th Century BC has been solved by a University of Cambridge PhD student.
Rishi Rajpopat, 27, decoded a rule taught by Panini, a master of the ancient Sanskrit language who lived around 2,500 years ago.
Sanskrit is mostly spoken in India by an estimated 25,000 people, the university said.
Mr Rajpopat said he had "a eureka moment in Cambridge" after spending nine months "getting nowhere".
"I closed the books for a month and just enjoyed the summer - swimming, cycling, cooking, praying and meditating," he said.
"Then, begrudgingly I went back to work, and, within minutes, as I turned the pages, these patterns starting emerging, and it all started to make sense."
He said he "would spend hours in the library including in the middle of the night", but still needed to work for another two-and-a-half years on the problem.
Sanskrit, although not widely spoken, is the sacred language of Hinduism and has been used in India's science, philosophy, poetry and other secular literature over the centuries.
Panini's grammar, known as the Astadhyayi, relied on a system that functioned like an algorithm to turn the base and suffix of a word into grammatically correct words and sentences.
However, two or more of Panini's rules often apply simultaneously, resulting in conflicts.
Panini taught a "metarule", which is traditionally interpreted by scholars as meaning "in the event of a conflict between two rules of equal strength, the rule that comes later in the grammar's serial order wins".
However, this often led to grammatically incorrect results.
Mr Rajpopat rejected the traditional interpretation of the metarule. Instead, he argued that Panini meant that between rules applicable to the left and right sides of a word respectively, Panini wanted us to choose the rule applicable to the right side.
Employing this interpretation, he found the Panini's "language machine" produced grammatically correct words with almost no exceptions.
"I hope this discovery will infuse students in India with confidence, pride and hope that they too can achieve great things," said Mr Rajpopat, from India.
His supervisor at Cambridge, professor of Sanskrit Vincenzo Vergiani, said: "He has found an extraordinarily elegant solution to a problem which has perplexed scholars for centuries.
"This discovery will revolutionise the study of Sanskrit at a time when interest in the language is on the rise."