Q:

How to prove that $f(p) = (\frac{3p-3}{p^2-1}) + (\frac{1}{p-1}) \times \sum_{q=3}^{l(p), with \ q\ prime} (\frac{q+1}{q-1})$ is always <= 1?

Let function $l(p)$ be defined as the largest prime number less than $p$.
For example: $l(7)=5$, $l(11)=7$, $l(17)=13$
Let the function $f(p)$ be defined as follows:
$$f(p) = \left(\frac{3p-3}{p^2-1}\right) + \left(\frac{1}{p-1}\right) \times \sum_{q=3}^{l(p), with \ q\  prime} \left(\frac{q+1}{q-1}\right)$$
where the summation is over prime numbers only. I.e. $q$ is always a prime.
Below are some examples of the values for $f(p)$:
$$f(3) = \frac{9-3}{9-1} + \frac{1}{3-1} \times 0$$
$$f(3) = \frac{6}{8}$$
$$f(5) = \frac{15-3}{25-1} + \frac{1}{5-1} \times \frac{3+1}{3-1}$$
$$f(5) = \frac{12}{24} + \frac{1}{4} \times 2$$
$$f(5) = 1$$
$$f(7) = \frac{21-3}{49-1} + \frac{1}{7-1} \times \left(\frac{3+1}{3-1} + \frac{5+1}{5-1}\right)$$
$$f(7) = \frac{18}{48} + \frac{1}{6} \times \left(2 + \frac {3}{2}\right)$$
$f(7) = 0.958333$
$f(11) = 0.733333$
$f(13) = 0.717063$
How to prove that $f(p)$ is always less than or equal to 1 for all prime numbers p?
Below is a graph of the values up to $p=101$. The curve appears to decline but there are exceptions, $f(31) > f(29)$ and $f(43) > f(41)$.

A:

The essence of this problem is finding a good upper bound for the sum over the primes. Let $\pi(n)$ denote the prime-counting function, i.e. $\pi(n)$ is the number of primes less than or equal to $n$, and let $H_n:=\sum_{k=1}^n\tfrac1k$ denote the $n$-th harmonic sum. Then
\begin{eqnarray*}
\sum_{\substack{q=3\\q\ \text{prime}}}^{l(p)}
\frac{q+1}{q-1}
&=&\sum_{\substack{q=3\\q\ \text{prime}}}^{p-1}\left(1+\frac{2}{q-1}\right)\\
&=&\left(\pi(p-1)-1\right)
+2\sum_{\substack{q=3\\q\ \text{prime}}}^{p-1}\frac{1}{q-1}\\
&\leq&\pi(p-1)-1+2\sum_{k=2}^{p-2}\frac1k\\
&=&\pi(p-1)-1+2(H_{p-2}-1)\\
&=&\pi(p-1)+2H_{p-1}-3.
\end{eqnarray*}
For all $n>1$ we have the well-known upper bounds
$$\pi(n)\leq\frac{n}{\ln(n)}\left(1+\frac{3}{2\log(n)}\right)
\qquad\text{ and }\qquad
H_n\leq\ln(n+1).$$
It follows that
\begin{eqnarray*}
f(p)
&=&\frac{3(p-1)}{p^2-1}+\frac{1}{p-1}\sum_{\substack{q=3\\q\ \text{prime}}}^{p-1}
\frac{q+1}{q-1}\\
&\leq&\frac{3(p-1)}{p^2-1}+\frac{1}{p-1}(\pi(p-1)+2H_{p-2}-3)\\
&\leq&\frac{3}{p+1}+\frac{1}{p-1}
\left(\frac{p-1}{\ln(p-1)}\left(1+\frac{3}{2\ln(p-1)}\right)
+\ln(p-1)-3\right)\\
&=&\frac{3}{p+1}+\frac{1}{\ln(p-1)}\left(1+\frac{3}{2\ln(p-1)}\right)
+\frac{\ln(p-1)}{p-1}-\frac{3}{p-1}.
\end{eqnarray*}
It is an exercise in basic calculus to show that the latter is strictly decreasing for $p\geq5$, and it is an exercise in basic algebra to show that the latter is less than $1$ for $p=5$.

