Problem 30 done.
There is a smarter way to set the loop limit, 9*9^5. It's close to a
million so I didn't change my original guess.