Well, your explanation doesn't actually seem to imply that the points awarded is dependent on the number of entrants, other than any player who ranks 9th or greater always gets 2% of 40. I can't quite figure out what the last part of your formula is, but it seems to be if you take that part off, and simplify the rest a bit, you get what it looks like you described:

if(r == 1, 1.0, if(r == 2, .80, if(r == 3, .70, if(r == 4, .60, if(r == 5, .50, if(r == 6, .40, if(r == 7, .30, if(r == 8, .2, if(r >= 9, .05, 0))))))))) * 40

1st, 40.00

2nd, 32.00

3rd, 28.00

4th, 24.00

5th, 20.00

6th, 16.00

7th, 12.00

8th, 8.00

9th, 2.00

10th, 2.00

11th, 2.00

12th, 2.00

13th, 2.00

14th, 2.00

15th, 2.00

16th, 2.00

17th, 2.00

18th, 2.00

19th, 2.00

20th, 2.00

This allows you to easily change the maximum points awarded (40). But the percentages of that maximum that is awarded doesn't change based on the number of players.... only on the finishing rank of a player.