解:(x+1)(x+2)=x²+3x+2.第三个因式必为x+4,(x²+3x+2)(x+4)=x³+4x²+3x²+12x+2x+8.=x³+7x²+14x+8.a=7, b=14. 3a-b=21-14=7.