g(x) = x3 - x2 - (m2 + m)x + 2m2+ 4m + 2
Since g(x) is divisible by x-4, g(4) = 0.
So, 64 - 16 - 4(m2 + m) + 2m2+ 4m + 2 = 0
Simplify to obtain: -2m2 + 50 = 0
m2= 25
m = ±5
If m = 5, then g(x) = x3 - x2 - 30x + 72
= (x-4)(x+6)(x-3)
The roots are all integers (4, -6, and 3)
If m = -5, then g(x) = x3 - x2 - 20x + 32
= (x-4)(x2 + 3x - 8)
The roots aren't all integers.
The only value of m that works is 5.