Let $n$ be any natural number greater than 2. Let $l$ be the greatest prime less than $n$. When $n$=3, $l$=2. When $n$=10, $l$=7. When $n$=25, $l$=23.
What is the relationship between $n$ and $l$? Can this relationship be expressed as a function?: $l$($n$)
\begin{align} l(3) & = 2 \\ l(4) & = 3 \\ l(5) & = 3 \\ l(6) & = 5 \\ l(7) & = 5 \\ \end{align}
$l$(7)=5 means that the greatest prime less than 7 is 5. Are there any known ways to calculate $l$($n$)? Is it possible to make a formula to calculate $l$($n$)?
The relation is indeed a function, and can be calculated. (Indeed, most computer algebra systems include such a function, or one very similar; see for example PARI/GP's
precprime.)Bounds on the value of this function are pretty well-studied; I think the results of Baker-Harman-Pintz are state-of-the-art, showing that the gap is $O(n^{0.525}).$