Formatting and style changes.
Optimised LCM routine.

Calculating the prime factors twice was silly,
so instead we just use a sieved array of primes.