Suppose P(x) can be written as P(x)=A(x)B(x) with A and B being non-constant polynomials with integer coefficients. Since A and B are not constant, they each have a degree of at least 1. The sum of the two degrees is equal to the degree of P, which is 3. This means that the two degrees must be 1 and 2. We can thus write, without loss of generality, A(x)=ax2+bx+c and B(x)=dx+e with a,b,c,d and e being integers. The product of the leading coefficients a and d is equal to the leading coefficient of P, which is 3. Since we could also multiply both A and B by -1, we may assume that a and d are both positive and thus, in some order, equal to 1 and 3.
First, assume that d=1. Substitute x=−1. We have
P(−1)=3⋅(−1)3+n−n−2=−5,
so
−5=P(−1)=A(−1)B(−1)=A(−1)⋅(−1+e).
We see that −1+e is a divisor of -5, so it is equal to −5,−1,1 or 5. This gives four possible values for e, namely −4,0,2 or 6. Furthermore, x=−e is a root of B and thus also of P.
If e=−4, then
0=P(4)=3⋅43−4n−n−2=190−5n
so n=38. We can indeed factorize P(x) as follows:
3x3−38x−40=(3x2+12x+10)(x−4)
If e=0, then
0=P(0)=−n−2
so n=−2. We can indeed factorize P(x) as follows:
3x3+2x=(3x2+2)x
If e=2, then
0=P(−2)=3⋅(−2)3+2n−n−2=−26+n
so n=26. We can indeed factorize P(x) as follows:
3x3−26x−28=(3x2−6x−14)(x+2)
If e=6, then
0=P(−6)=3⋅(−6)3+6n−n−2=−650+5n
so n=130. We can indeed factorize P(x) as follows:
3x3−130x−132=(3x2−18x−22)(x+6)
Now assume that d=3. We have
−5=P(−1)=A(−1)B(−1)=A(−1)⋅(−3+e)
We see that −3+e is a divisor of -5, so it is equal to −5,−1,1 or 5. This gives four possible values for e, namely −2,2,4 or 8. Furthermore, x=3−e is a root of B and thus also of P. We see that e is never divisible by 3. We have
0=P(3−e)=3⋅(3−e)3+3en−n−2=−9e3+3e−3n−2,
so 3e−3n=9e3+2, thus (e−3)n=3e3+6. But this leads to a contradiction, because the left side is an integer and the right side is not, since 3 is not a divisor of e.
We conclude that the solutions are: n=38,n=−2,n=26 and n=130.