problem 5 solved

My own code, but slow.  Will work on improving run time.