first solution to problem 1 completed