BAYHAQI 3804:
from Abū al-ʿAbbās Muḥammad b. Yaʿqūb from my father —
[Machine] I sat with Umar bin Al-Khattab, and he said: "O Ibn Abbas, have you heard from the Prophet ﷺ about a person who forgets their prayer and does not know whether they increased or decreased in it?" I said: "And have you heard anything about it, O Amir al-Mu'minin, from the Messenger of Allah ﷺ ?" He said: "No, by Allah, I have not heard anything from him regarding it, nor have I asked him about it. But when Abdur-Rahman bin Awf came, Umar informed him about it. And Abdur-Rahman said: 'But I have heard this from the Prophet ﷺ .' Umar said: 'Then you have the knowledge that we were seeking, so what did you hear?' Abdur-Rahman said: 'I heard the Prophet ﷺ say: If any one of you is in doubt about his prayer, then he should consider it as one unit (rak'ah) and two units (rak'ah), and if he is in doubt about two units (rak'ah) or three, then he should consider it as two units (rak'ah), and if he is in doubt about three or four, then he should consider it as three units (rak'ah), until the doubt concerning the addition is removed, and he should prostrate twice before he gives the Salam, then he should give the Salam, and this is its meaning.'"
البيهقي ٣٨٠٤:
عن ابو العباس محمد بن يعقوب عن أبي —
جَلَسْتُ إِلَى عُمَرَ بْنِ الْخَطَّابِ ؓ فَقَالَ يَا ابْنَ عَبَّاسٍ هَلْ سَمِعْتَ مِنَ النَّبِيِّ ﷺ فِي الرَّجُلِ إِذَا نَسِيَ صَلَاتَهَ فَلَمْ يَدْرِ أَزَادَ أَمْ نَقَصَ مَا أَمَرَ بِهِ فِيهِ؟ قُلْتُ وَمَا سَمِعْتَ أَنْتَ يَا أَمِيرَ الْمُؤْمِنِينِ مِنْ رَسُولِ اللهِ ﷺ شَيْئًا فِي ذَلِكَ؟ قَالَ لَا وَاللهِ مَا سَمِعْتُ مِنْهُ فِيهِ شَيْئًا وَلَا سَأَلْتُ عَنْهُ إِذْ جَاءَ عَبْدُ الرَّحْمَنِ بْنُ عَوْفٍ فَقَالَ فِيمَا أَنْتُمَا؟ فَأَخْبَرَهُ عُمَرُ فَقَالَ سَأَلْتُ هَذَا الْفَتَى عَنْ كَذَا وَكَذَا فَلَمْ أَجِدْ عِنْدَهُ عِلْمًا قَالَ عَبْدُ الرَّحْمَنِ لَكِنْ عِنْدِي لَقَدْ سَمِعْتُ ذَلِكَ مِنَ النَّبِيِّ ﷺ فَقَالَ عُمَرُ فَأَنْتَ عِنْدَنَا الْعَدْلُ الرِّضَا فَمَاذَا سَمِعْتَ؟ قَالَ سَمِعْتُ النَّبِيَّ ﷺ يَقُولُ إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ فَشَكَّ فِي الْوَاحِدَةِ وَالِثْنَتَيْنِ فَلْيَجْعَلْهُمَا وَاحِدَةً وَإِذَا شَكَّ فِي الِاثْنَتَيْنِ وَالثَّلَاثِ فَلْيَجْعَلْهَا اثْنَتَيْنِ وَإِذَا شَكَّ فِي الثَّلَاثِ وَالْأَرْبَعِ فَلْيَجْعَلْهَا ثَلَاثًا حَتَّى يَكُونَ الْوَهْمُ فِي الزِّيَادَةِ يَسْجُدُ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ ثُمَّ يُسَلِّمُ وَبِمَعْنَاهُ
hadithunlocked.com