A mantra. As per Mahabharata Vanaparva Chapter 66, verse 21, after being separated from Damayanti, Nala roamed in the jungles and saved a naga Karkodaka from a fire. To show his gratitude, Karkodaka bit Nala and the venom gave him a dark complexion. He also told Nala that he should go to the capital of the kingdom of Ayodhya, ruled by Rituparna, and that the king, being an expert in aksha, would give Nala the knowledge of the Akshahridayamantra. People with the knowledge of this mantra can automatically figure out the number of leaves and flowers in a tree and even the calculations behind gambling. As per the advice of Karkodaka, Nala approached Rituparna. While he was staying there, a brahmin called Sudeva arrived there and told the king about the second marriage of Damayanti. With the help of Nala, an expert charioteer, he quickly started for Vidarbha.
On the way, Rituparna’s cloak accidentally fell off. Rituparna asked Nala to stop the chariot, but Nala informed him that the chariot had already crossed a yojana in a second. On seeing a huge tree in the forest, the king informed Nala that that it had 5 crore leaves and 2095 fruits. Nala was amazed. They both confided – Nala was able to drive the chariot with such speed because of the Ashwahridaya mantra, and the king was able to know the number of leaves and fruits because of the Akshahridayamantra. They taught each other the mantras. According to the Mahabharata, Vanaparva Chapter 72, Nala was able to win back his kingdom in the game of gambling thanks to this knowledge.