Project Euler 463 - A weird recurrence relation

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