It really depends on the players, system, and type of game you want to run. I've run AD&D and BECMI games both solo and in pairs without any difficulty whatsoever, but also run a table with almost a dozen players. IIRC 3E and 4E were specifically designed around 4 players, so that would be the sweet spot for the system. 5E seems to work best with 4-5, with 5 being my preference.
If you're wanting to run an RP heavy game, the few the players the better. I ran a game with 3 players that was excellent, but the moment a 4th player was added, one of the original 3 was pushed out of the limelight unless I went out of my way to pull her in. A more combat intensive campaign works better with a larger group, since the combat will be much less swingy, as bad rolls are overall countered by good rolls of other.
If you're wanting to run an RP heavy game, the few the players the better. I ran a game with 3 players that was excellent, but the moment a 4th player was added, one of the original 3 was pushed out of the limelight unless I went out of my way to pull her in. A more combat intensive campaign works better with a larger group, since the combat will be much less swingy, as bad rolls are overall countered by good rolls of other.