\(x^2+7=x^2-1+8=\left(x-1\right)\left(x+1\right)+8⋮\left(x+1\right)\Leftrightarrow8⋮\left(x+1\right)\)
\(\Leftrightarrow x+1\inƯ\left(8\right)=\left\{-8,-4,-2,-1,1,2,4,8\right\}\Leftrightarrow x\in\left\{-9,-5,-3,-2,0,1,3,7\right\}\).d\(x^2+8=x^2-4+4=\left(x-2\right)\left(x+2\right)+4⋮\left(x+2\right)\Leftrightarrow4⋮\left(x+2\right)\)
\(\Leftrightarrow x+2\inƯ\left(8\right)=\left\{-4,-2,-1,1,2,4\right\}\Leftrightarrow x\in\left\{-6,-4,-3,-1,0,2\right\}\)
Suy ra \(x\in\left\{-3,0\right\}\).