This is a good question for practicing primality and algebra. Shout out to Nate W. for sending me both the problem and his solution. The solution you see in this video was provided along with the problem. I could not produce a more efficient solution.