In algorithms like Dixon's factorization a factor base is used, which contains all primes below a bound.
Then calculates $x^2 \mod n$, and then checks it is in factor base or not.
Suppose $P$ is the factor base for bound $B$.
We calculate the value $x^2 \mod n$, then how to check whether the result contains only prime factors from the factor base?
Let $x^2 \mod n=q_1^{e_1}q_2^{e_2}q_3^{e_3}\cdots q_k^{e_k}$ and $P=\{p_1,p_2,p_3,\cdots,p_l\}$
Then how to check whether each $q_i$ is present in factor base? and how to get corresponding arity $e_i$?
Is it achieved by repetitive division or by means of any other efficient methods?