Several ways. Simplest:
switch(rank, 1, 32, 2, 27, 3, 23, 4, 19, 5, 17, 6, 15, 7, 13, 8, 11, 9, 9, 10, 5, 11, 5, 12, 5, 13, 5, 14, 5, 15, 5, 16, 5, 17, 5, 18, 5, 3)
Little bit fancier:
3 + if(rank < 19, lswitch(19 - rank, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 8, 10, 12, 14, 16, 20, 24, 29))
Little more complicated:
3 + if(rank < 19, 2) + if(rank < 10, lswitch(10 - rank, 4, 6, 8, 10, 12, 14, 18, 22, 27))
And a little more complicated:
3 + if(rank < 19, 2) + if(rank < 10, 2 + (10 - rank) * 2) + if(rank < 4, (4 - rank) * 2) + if(rank = 1, 1)
They all award the same points, so use whichever you want. The first is the most straightfoward, as it is basically just stating the points for each rank from 1st through 18th. The last one, while maybe a little more complicated, is actually more indicative of how points are awarded. Default 3 points, plus 2 more for placing 18th or better, plus a few more for ranks 4 through 10, plus a few more for 1st through 3rd, plus a bonus point for 1st.