It was narrated that Ibn 'Abbas said:
"Allah, the Mighty and Sublime, enjoined the prayer on the tongue of your Prophet (ﷺ): While a resident four (rak'ahs), while traveling two, and at times of fear one." (ES)
Reference (ES): Sunan an-Nasa'i 1442 (ES)
In-book reference (ES): Book 15, Hadith 10 (ES)
English translation (ES): Vol. 2, Book 15, Hadith 1443 (ES)