Project Euler 167 - Investigating Ulam Sequences

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