problem 24 done (using builtin itertools)