Ah, the hospital's rule. Of course. I vaguely remember that from high school.
More importantly, I also found out that my memory of integration by parts was faulty, and that seems to have been the real issue. From the top:
Not fully calculated because the math gets extremely messy and complicated pretty fast, but a description of how to go about it
Although a better answer might be that if there are 10 people playing a game with at least $10 entry fee and $100 payout with a non-zero chance that no one will win and the house will keep everything if everyone ends up picking a number in common with at least one other player, then your best move is to not play.