Partial Solution to Problem 3 in Python
(Does not return in reasonable time)