The object of the preposition is not the word alone, but the entire clause. Therefore the correct grammar is 'to whoever solves the puzzle '. Practically speaking, however, we are likely to hear either, with 'whoever' being less formal.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
CalifJimThanks for the welcome!This is the first time anyone has ever welcomed me to a forum!And a belated thank-you from me, too!