p will divide the difference f(x)  g(x) = 2x^3 + 10x^2 + 2.
Both functions are always odd for integers so they're divisible only by odd primes and the factor 2 is irrelevant. Divide it out and subtract the result from f(x) to get x^3(x+4)(x+1).
x<p so the factor x^3 is irrelevant too. Then the possibilities are x=4 or x=1 mod p.
Apply those values to find f(x)=5 or 17 mod p and g(x)=5 or 17 mod p. As the residues are prime, only p=5 or p=17 work.
Checking, f(4)=2705=5*541, g(4)=2415=5*483, f(13)=525929=17*30937 and g(13)=519843=17*30579.
The primes are thus 5 and 17 with sum 22.

Posted by xdog
on 20181117 21:05:43 