Đặt \(Q\left(x\right)=P\left(x\right)-x^2\Rightarrow Q\left(x\right)\) có bậc tối đa là 5
Ta có \(Q\left(1\right)=P\left(1\right)-1^2=0\)
Tương tự \(Q\left(2\right)=Q\left(3\right)=Q\left(4\right)=Q\left(5\right)=0\)
\(\Rightarrow Q\left(x\right)\) có 5 nghiệm \(x=\left\{1;2;3;4;5\right\}\)
\(\Rightarrow Q\left(x\right)=\left(x-1\right)\left(x-2\right)\left(x-3\right)\left(x-4\right)\left(x-5\right)\)
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-5\right)+x^2\)
\(\Rightarrow P\left(6\right)=156\) ; \(P\left(7\right)=769\)