Redid solution 5 using LCM.

http://en.wikipedia.org/wiki/Least_common_multiple

This was way faster than original naive solution.