Take a function $f(n)$ that takes the differences from $n$ to each prime less than $n$ and sums them all together. For example,
$$f(12) = (12 - 11) + (12 - 7) + (12 - 5) + (12 - 3) + (12 - 2) = 1 + 5 + 7 + 9 + 10 = 32.$$
In mathematical notation,
$$f(n) = \displaystyle\sum_{p}^{n} n - p.$$
Now, create an integer sequence where $n$ is in this sequence if $f(n)$ is prime. This sequence (not in the OEIS to my knowledge) begins $$4, 5, 7, 9, 10, 13, 14, 17, 20, 23, 31, 39, 40, 45, 53, 55, 58, 59, 69, 73...$$ Given an $n > 0$, find the ratio of the number of elements in this sequence less than $n$ to the number of primes less than $n$. What does this ratio approach as $n \to \infty$?
My computer program has calculated it up to $n = 1000000$, reaching a value of $67435/78498\approx 0.85906647303116.$ For $n \in [8000, 1000000]$, the ratio does not stray more than two hundreths away from this value.
Does this ratio approach a nonzero constant? What constant is this?
The only similar constant I know of is $\cos(\pi/6) = \tfrac{\sqrt 3}{2} \approx 0.86602540378...$ but there is no evidence to show that this is what the ratio approaches other than pure chance. Is there any rigorous way to demonstrate what precise value this ratio goes to as $n \to \infty$ (if it doesn't approach $0$ or infinity)? Thanks for your help!