Working on problem 5. It works for smaller numbers but it doesn't for long.