Fix a positive integer $ r$ . I evaluate
1 - (1 + sopf[n] - PrimeNu[n])/n
for $ n=4$ to $ n=r$ . Then I want to determine whether the $ k$ th largest among these numbers is $ \le1-k/r$ .
Here’s the code for $ r=10$ :
sopf[n_] := Plus @@ (First /@ FactorInteger[n]) Table[1 - (1 + sopf[n] - PrimeNu[n])/n, {n, 4, 10}]; m = Sort[Table[1 - (1 + sopf[n] - PrimeNu[n])/n, {n, 4, 10}]] Table[Part[m, -k] <= 1 - k/10, {k, 1, 10 - 1 - PrimePi[10]}]
The output for the inequalities is
{True, True, True, True, True}.
I have no problem with this code or the output.
Now I’d like to run another table where I replace 10 with a variable $ r$ , so $ r$ is my upper bound for $ n$ . My attempt is
sopf[n_] := Plus @@ (First /@ FactorInteger[n]) Table[1 - (1 + sopf[n] - PrimeNu[n])/n, {n, 4, r}]; m = Sort[Table[1 - (1 + sopf[n] - PrimeNu[n])/n, {n, 4, r}]] Table[Table[Part[m, -k] <= 1 - k/r, {k, 1, r - 1 - PrimePi[r]}], {r, 4, 10}]
However, the 7th string in the output, corresponding to $ r=10$ , is
{True, True, False, True, True}
which is inconsistent with my previous example. How can I correct this so that I obtain True if and only if the $ k$ th largest number in the list m
is $ \le 1-k/r$ ?