I think this will work:
if(r<10, 3, 3) + switch (r, 10, 4, 9, 5, 8, 6, 7, 7, 6, 8, 5, 9, 4, 10, 3, 12, 2, 15, 1, 17) + nh + nr
I still am not a fan of rewarding rebuys with points (favors loose play near the end of rebuy period and punishes solid play). Especially since rebuys are rewarded by getting another chance already whereas those who can't rebuy are thus punished (solid play throughout, but then beat by a suckout from someone who just rebought).
I would hate to be the guy who lost out of winning a season points score simply because the guy I was up against rebought more than me - even though we had similar finishing places throughout the season.
Even if you penalize a person for a rebuy (say dock them 0.5 or 1 point), I doubt that will inhibit someone from rebuying. They stand to gain more points by staying in the tourney than they lose by rebuying.
But, its your tourney of course
Another thing might be to give a more even spread of points at the top end. The 2nd place person gets more points over the 3rd place (3 points) than the 1st person gets over 2nd (2 points). 2 ways to fix this, either give person in 2nd 17 points or 17.5 points.
Just my need for symmetry
(if you wanted to do this, just change the final switch parameter pair of numbers from "2, 15", to either "2, 14" or "2, 14.5".
Hope that helps.