Completed correct solution with brute force
Added log for problem 47