The Messenger of Allah ﷺ performed itikaf during the middle ten days of Ramadan, seeking Laylat al-Qadr before it had been made clear to him. When those days had passed, he ordered his shelter to be taken down. Then it was disclosed to him that it lay within the last ten days, so he ordered the shelter to be put back up, and it was reassembled. He then performed itikaf throughout the last ten days.Afterwards he came out to the people and said, "People, Laylat al-Qadr was made known to me, and I came out to inform you of it. But two men came arguing with each other, and Satan was with them, so I forgot it. Seek it in the ninth, the seventh, and the fifth."I said, "Abu Saeed, you know more about counting than we do."He replied, "I have more right to that knowledge than you."I asked, "What are the ninth, the seventh, and the fifth?"He said, "Leave aside the night you call the twenty-first, and the one that follows it is the ninth. Leave aside the night you call the twenty-third, and the one that follows it is the seventh. Leave aside the night you call the twenty-fifth, and the one that follows it is the fifth."
حدثنا إسماعيل بن إبراهيم عن سعيد الجريري عن أبي نضرة
اعتكف رسول الله ﷺ العشر الأوسط من رمضان وهو يلتمس ليلة القدر قبل أن تبان له فلما تقضين أمر ببنيانه فنقض ثم أبينت له أنها في العشر الأواخر فأمر بالبناء فأعيد ثم اعتكف العشر الأواخر ثم خرج على الناس فقال يا أيها الناس إنها أبينت لي ليلة القدر فخرجت لأخبركم بها فجاء رجلان يحيفان معهما الشيطان فنسيتها فالتمسوها في التاسعة والسابعة والخامسة فقلت يا أبا سعيد إنكم أعلم بالعدد منا قال أنا أحق بذاك منكم فما التاسعة والسابعة والخامسة قال تدع التي تدعون إحدى وعشرين والتي تليها التاسعة وتدع التي تدعون ثلاثة وعشرين والتي تليها السابعة وتدع التي تدعون خمسة وعشرين والتي تليها الخامسة
Its isnad is sahih. Saeed Jariri is Ibn Iyas, a well-known trustworthy narrator, and the hadith was narrated by the leading scholars. See Muslim 1/827, no. 1117, and others.