Brute forced problem 6
Problem 7 done, but slow