Updated solution for problem 32

Much faster now! 500x