x40 Speed up for problem 23