Project Euler 407 - Idempotents

Official link: https://projecteuler.net/problem=407

Note: My code runs in ~350 seconds, but my understanding is good so I'm happy with this problem!