Terrible solution to 51
Problem 57
Problem 58