Hadith Q1028

وَالْأَمْرِ بِالْبِنَاءِ عَلَى التَّحَرِّي إِذَا كَانَ قَلْبُهُ إِلَى أَحَدِ الْعَدَدَيْنِ أَمْيَلَ، وَكَانَ أَكْثَرُ ظَنِّهِ أَنَّهُ قَدْ صَلَّى مَا الْقَلْبُ إِلَيْهِ أَمْيَلُ
The statement regarding the command to base it on investigation and inquiry when his heart inclines more towards a certain number, and he predominantly thinks that the number his heart inclines towards is the number of prayers he has performed.
Hadith Reference صحيح ابن خزيمه / جماع أبواب السهو فى الصلاة / Q1028