Source for my implementation of the first homework problem.