Limit of a formula to find the closest number to a prime less than an even number in given range

135 Views Asked by At

Let's say the 'closest' is the diff between the number get by the formula and a prime less than $1$, and define samples:

$f1(n) = n - 1$

$f2(n) = n - \left\lfloor \sqrt{n} \right\rfloor^2 + \frac{\pi}{4}\left\lfloor \sqrt{n} \right\rfloor^2$

$f3(n) = n - \left\lfloor \sqrt{n} \right\rfloor^2 + \left(\frac{4 \times \sqrt{2}}{7} - \frac{15}{28} \right)\pi\left\lfloor \sqrt{n} \right\rfloor^2$

$... , n\in \mathbb{2N}$

For example $f1(6) = 5$, which closest to a prime number $5$ that less an $6$.

As Ivan Neretin commented: Any formula will do the same.

Check the first $500$ even numbers, $f1$ give $167$ closest numbers, $f2$ give $171$ closest numbers and $f3$ give $173$ closest numbers,maybe $fx$ give $373$ closest numbers.

My question is: for a given range, dose these kind of formulas has a limit less than the legth of the range of the 'closest'? That is maybe we can say for the first $50$ even numbers, we cant find a formula that give closest numbers exceed $45$.