FIR Filter length Upper Bound
Many people have asked themselves this question. Unfortunately, there is no exact solution, just approximations. One relevant paper is Practical Design Rules for Optimum Finite Impulse Response Low-Pass Digital Filters by Herrmann, Rabiner and Chan, where they basically fit a formula to their data obtained from lots of designs. A simplified formula is [1]

$$M=\frac{-10\log_{10}(\delta_1\delta_2)-13}{2.324\;\Delta\omega}$$

where $M$ is the filter order, and $\Delta\omega=\omega_s-\omega_p$ is the width of the transition band.

Also the Matlab function firpmord.m uses some formula to estimate the necessary filter order, but they also say that the required order is often underestimated.

[1] Discrete-Time Signal Processing, Oppenheim, Schafer, Buck (2nd ed.), p. 502