Find all real polynomials $P(x)$ such that for every four distinct natural numbers $a, b, c, d$ such that $a^2 + b^2 + c^2 = 2d^2$ with $gcd(a, b, c, d) = 1$ the following equality holds: $$2(P(d))^2 + 2P(ab + bc + ca) = (P(a + b + c))^2$$.
Source: Indian Postal Coaching 2009 set 2 p5
Tags: algebra, polynomial
Find all real polynomials $P(x)$ such that for every four distinct natural numbers $a, b, c, d$ such that $a^2 + b^2 + c^2 = 2d^2$ with $gcd(a, b, c, d) = 1$ the following equality holds: $$2(P(d))^2 + 2P(ab + bc + ca) = (P(a + b + c))^2$$.