See if this is works for you. It's a little verbose but I think it's what you've described.
assign("lowRank", ceil(0.8 * n))
assign("upper80", round(8 * (sqrt(n) / sqrt(r)) * (1 + log10(bc + 0.25))))
assign("lower20", round(8 * (sqrt(n) / sqrt(lowRank)) * (1 + log10(bc + 0.25))))
assign("step", (lower20 - 10) / (n - lowRank))
if(r <= lowRank, upper80, 10 + ((n - r) * step))
I think it works fine. Is there a way to round the bottom numbers tho? Looks like this:
10
12.83
15.67
Think I got it! Looks right:
assign("lowRank", ceil(0.8 * n))
assign("upper80", round(8 * (sqrt(n) / sqrt(r)) * (1 + log10(bc + 0.25))))
assign("lower20", round(8 * (sqrt(n) / sqrt(lowRank)) * (1 + log10(bc + 0.25))))
assign("step", (lower20 - 10) / (n - lowRank))
if (r <= lowRank, upper80, 10 + round((n - r) * step))