Commit solution to problem 5

This program takes a while to complete