If you’re familiar with the rational root theorem you will probably see a connection. Indeed, the proof that the question asks for is along the same lines. I have to admit I didn’t remember the proof ...
This Rust program implements polynomial factorization using the Rational Root Theorem. It evaluates the possible rational roots of a polynomial and determines the actual roots. Computes the divisors ...