add full solution to problem 52, permuted multipes