\(B=\left(x+1\right)\left(x+2\right)\left(x+3\right)\left(x+4\right)-24\)
\(=\left(x^2+5x+4\right)\left(x^2+5x+6\right)-24\)
\(=\left(x^2+5x\right)^2+10\left(x^2+5x\right)\)
\(=\left(x^2+5x\right)\left(x^2+5x+10\right)\)
\(=x\left(x+5\right)\left(x^2+5x+10\right)\)