Solved problem 70 (totient permutation), but code is messy.