Create problem 30

Loops up to 1,000,000, but I suppose you can run it to infinity to be sure there are no other qualifying numbers. There is probably a theorem that sets an upper bound or makes this calculation more efficient but I'm unaware of any. :/