Problem 3 solved, but loop too big
soved problem 4