fix happy_numbers

This fixes compiler errors and warnings and passes all tests.