During the time of the Prophet, the prayers over the newly deceased had five takbirs (units). Ahmad ibn Hanbal narrates from ‘Abd al-A‘la, “I prayed behind Zayd ibn Arqam over a dead body, and I did the takbirat five times.” A man stood behind him and held his hand and asked whether he had forgotten. ‘Abd al-A‘la replied, “No, but I prayed behind Abul-Qasim Muhammad and he did five takbirat, and I would not do other than that.”
For reference, al-Suyuti mentions the name of the companion who changed the number of takbirs from five to four.
 Musnad Ahmad ibn Hanbal, Vol. 4, 370; Sahih Muslim, “Prayers over the Graves”; Sahih al-Nisa’i, “Kitab al-Janazah”
 al-Suyuti, al-Kamil, Vol. 15, 29; al-Suyuti, Tarikh al-Khulafa’, 137