solved euler 40, easy solution, could maybe be faster, but <<1 min