~40ms optimisation to Problem 23
Slight optimisation to my prime factorisation method