First aproaches to problem 40. Correct solutins, but more efficient ones should be found