Xét \(Q\left(x\right)=P\left(x\right)-x^2\)
Thay \(x=1\Rightarrow Q\left(1\right)=P\left(1\right)-1^2=0\)
\(x=2\Rightarrow Q\left(2\right)=P\left(2\right)-2^2=0\)
Tương tự \(Q\left(3\right)=0\) ; \(Q\left(4\right)=0\)
\(\Rightarrow Q\left(x\right)\) có ít nhất 4 nghiệm \(x=\left\{1;2;3;4\right\}\)
\(\Rightarrow Q\left(x\right)=\left(x-1\right)\left(x-2\right)\left(x-3\right)\left(x-4\right)\left(x-k\right)\) với \(k\) là số thực bất kì
Mà \(Q\left(x\right)=P\left(x\right)-x^2\Rightarrow P\left(x\right)=Q\left(x\right)+x^2\)
\(\Rightarrow P\left(x\right)=\left(x-1\right)\left(x-2\right)\left(x-3\right)\left(x-4\right)\left(x-k\right)+x^2\)
Do \(P\left(5\right)=2\Rightarrow\left(5-1\right)\left(5-2\right)\left(5-3\right)\left(5-4\right)\left(5-k\right)+5^2=2\)
\(\Leftrightarrow24\left(5-k\right)=-23\Rightarrow k=\frac{143}{24}\)
\(\Rightarrow P\left(x\right)=\left(x-1\right)\left(x-2\right)\left(x-3\right)\left(x-4\right)\left(x-\frac{143}{24}\right)+x^2\)
\(\Rightarrow P\left(6\right)=41\) ; \(P\left(7\right)=424\)