Project Euler 329 - Prime Frog

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