Project Euler #117: Red, green, and blue tiles