Sahih Muslim 1167 f
Abu Sa'id al-Khudri (Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) observed i'tikaf in the middle ten days of Ramadan to seek Lailat-ul-Qadr before it was made manifest to him. When (these nights) were over, he commanded to strike the tent. Then it was made manifest to him that (Lailat-ul-Qadr) was in the last ten nights (of Ramadan), and commanded to pitch the tent (again). He then came to the people and said: O people, Lailat-ul-Qadr was made manifest to me and I came out to inform you about it that two persons came contending with each other and there was a devil along with them and I forgot it. So seek it in the last ten nights of Ramadan. Seek it on the ninth, on the seventh and on the fifth. I (one of the narrators) said: Abu Sa'id, you know more than us about numbers. He said: Yes, indeed we have better right than you. I said: What is this ninth, seventh, and fifth? He said: When twenty-one (nights are over) and the twenty-second begins, it is the ninth, and when twenty-three (nights) are over, that which follows (the last night) is the seventh, and when twenty-five nights are over, what follows it is fifth. Ibn Khallad said: Instead of the word Yahliqan (contending), he said Yakhtasiman, (they are disputing).
حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَأَبُو بَكْرِ بْنُ خَلاَّدٍ قَالاَ حَدَّثَنَا عَبْدُ الأَعْلَى، حَدَّثَنَا سَعِيدٌ، عَنْ أَبِي نَضْرَةَ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ، - رضى الله عنه - قَالَ اعْتَكَفَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْعَشْرَ الأَوْسَطَ مِنْ رَمَضَانَ يَلْتَمِسُ لَيْلَةَ الْقَدْرِ قَبْلَ أَنْ تُبَانَ لَهُ فَلَمَّا انْقَضَيْنَ أَمَرَ بِالْبِنَاءِ فَقُوِّضَ ثُمَّ أُبِينَتْ لَهُ أَنَّهَا فِي الْعَشْرِ الأَوَاخِرِ فَأَمَرَ بِالْبِنَاءِ فَأُعِيدَ ثُمَّ خَرَجَ عَلَى النَّاسِ فَقَالَ ‏
"‏ يَا أَيُّهَا النَّاسُ إِنَّهَا كَانَتْ أُبِينَتْ لِي لَيْلَةُ الْقَدْرِ وَإِنِّي خَرَجْتُ لأُخْبِرَكُمْ بِهَا فَجَاءَ رَجُلاَنِ يَحْتَقَّانِ مَعَهُمَا الشَّيْطَانُ فَنُسِّيتُهَا فَالْتَمِسُوهَا فِي الْعَشْرِ الأَوَاخِرِ مِنْ رَمَضَانَ الْتَمِسُوهَا فِي التَّاسِعَةِ وَالسَّابِعَةِ وَالْخَامِسَةِ ‏"‏ ‏.‏ قَالَ قُلْتُ يَا أَبَا سَعِيدٍ إِنَّكُمْ أَعْلَمُ بِالْعَدَدِ مِنَّا ‏.‏ قَالَ أَجَلْ ‏.‏ نَحْنُ أَحَقُّ بِذَلِكَ مِنْكُمْ ‏.‏ قَالَ قُلْتُ مَا التَّاسِعَةُ وَالسَّابِعَةُ وَالْخَامِسَةُ قَالَ إِذَا مَضَتْ وَاحِدَةٌ وَعِشْرُونَ فَالَّتِي تَلِيهَا ثِنْتَيْنِ وَعِشْرِينَ وَهْىَ التَّاسِعَةُ فَإِذَا مَضَتْ ثَلاَثٌ وَعِشْرُونَ فَالَّتِي تَلِيهَا السَّابِعَةُ فَإِذَا مَضَى خَمْسٌ وَعِشْرُونَ فَالَّتِي تَلِيهَا الْخَامِسَةُ .‏ وَقَالَ ابْنُ خَلاَّدٍ مَكَانَ يَحْتَقَّانِ يَخْتَصِمَانِ ‏.‏