Project Euler: Problem 46