Project Euler #79: Passcode derivation