I will so the solution using synthetic division (since it's faster, takes less space, and often less error prone)
#{:
(color(brown)("[1]"),,"|",color(brown)(x^4),color(brown)(x^3),color(white)("X")color(brown)(x^2),color(white)("XX")color(brown)(x^1),color(white)("XX")color(brown)(x^0)),
(color(brown)("[2]"),,"|",-1,-1,-1,color(white)("X")-7,color(white)("X")-7),
(color(brown)("[3]"),,"|",,-2,-6,-14,-42),
(,bar(color(white)("XXX")),bar(color(white)("XXX")),bar(color(white)("XXX")),bar(color(white)("XXX")),bar(color(white)("XXX")),bar(color(white)("XXX")),bar(color(white)("XXX"))),
(color(brown)([4]),xx (color(red)(+)2),"|",color(blue)(-1),color(blue)(-3),color(blue)(-7),color(blue)(-21), color(green)(-49)),
(color(brown)([5]),,,color(white)("X")color(brown)(x^3),color(white)("X")color(brown)(x^2),color(white)("X")color(brown)(x^1),color(white)("X")color(brown)(x^0),color(white)("X")color(brown)("R"))
:}#
Notes:
The entries in #color(brown)("brown")# would not normally be written down; they are only here for clarity.
Remember if dividing by #(xcolor(red)(-)2)#, the synthetic division multiplier must be #(color(red)(+)2)#