Tulsidas in the Bala Kanda of His Ramcharitmanas writes:
I greet the name "Rama" of the chief of Raghus, which is composed of seed-letters representing the fire-god, the sun-god and the moon-god (viz., Ra, A and Ma respectively). It is the same as Brahma (the creative aspect of God), Vishnu (His preservative aspect) and Shiva (His disintegrating aspect), and the vital breath of the Vedas; It is attributeless, peerless and a mine of virtues. It is the great spell which Lord Mahesvara mutters and which, when imparted by Him at Kashi (the modern Varanasi) leads to emancipation. Its glory is known to Lord Ganesha, who is worshipped before all others as a glory of the Name. The oldest poet (Valmiki) is acquainted with the glory of the Name, inasmuch as he attained to purity by repeating It in the reverse order. Hearing the verdict of Lord Shiva that the name is as good as a thousand other names of God, Goddess Bhavani (Parvati) dined with Her consort after uttering It only once. Noticing such partiality of Her heart for the Name, Hara (Lord Shiva) made that lady, who was the ornament of Her sex, the ornament of His own person (i.e., made Her a part of His own being by assigning to Her the left half of His body). Shiva knows full well the power of the Name, due to which deadly poison served the purpose of nectar to Him.
What I am interested is the part in bold. In the footnotes of the Gita Press's English translation of the Ramcharitmanas on that very page, it is stated:
We read in the Puranas how there was a scramble for precedence among the gods, each of whom claimed the first position for himself. They approached Brahma for a ruling. He told them that they should race round the world and that whoever finished the round quickest of all would be accounted the highest. Ganesha, who rode on no better animal than a rat, naturally lagged behind. He met on the way the celestial sage Narada, who advised him to scratch the word "Rama" on the ground and pace round It, as the word comprised in Itself the entire creation. Ganesha did accordingly and was naturally the first to finish the round of the universe. Brahma appreciated this act of Ganesha and conceded his title to precedence over all the other gods. Since then Ganesha has uninterruptedly enjoyed the right of being worshipped first of all.
My question is which Puranas describe Ganesha carving the name of Rama on a piece of ground and pacing around it?