problem 49, brutally fugly, repeated permutations galore