Factors in a different base $\ 2b^2\!+\!9b\!+\!7\,\mid\, 7b^2\!+\!9b\!+\!2$ 
Two numbers $297_B$ and $792_B$, belong to base $B$ number system. If the first number is a factor of the second number, then what is the value of $B$?

Solution:
 
But base cannot be negative. Could someone please explain where I am going wrong?
 A: Going $1$ step more with Euclid's algorithm reveals a common factor $\,b\!+\!1.\,$ Cancelling it
$$\dfrac{7b^2\!+\!9b\!+\!2}{2b^2\!+\!9b\!+\!7} = \color{#c00}{\dfrac{7b\!+\!2}{2b\!+\!7}}\in\Bbb Z\ \, \Rightarrow\,\ 7-2\ \dfrac{\color{#c00}{7b\!+\!2}}{ \color{#c00}{2b\!+\!7}}\, =\, \dfrac{45}{2b\!+\!7}\in\Bbb Z\qquad$$
Therefore $\,2b\!+\!7\mid 45\ $ so $\,b> 9\,$(= digit) $\,\Rightarrow\,2b\!+\!7 = 45\,$ $\Rightarrow\,b=19.$
A: The long division is the source of the error; you can't have $7/2$ as the quotient.  The quotient needs to be an integer, that's what "factor" means.
If the quotient is $2$, then the base is $4$. This is found by solving $7B^2+9B+2=\color{red}{  2}(2B^2+9B+7)$, and discarding the negative root.
If the quotient is $3$, then the base is $19$. This is found by solving $7B^2+9B+2=\color{red}{  3}(2B^2+9B+7)$, and discarding the negative root.
No other quotients make any sense.  However, if the base is $4$, then you don't get digits $7$ and $9$.  Hence the answer must be $B=19$.
A: Since $b+1>0$ and $$(b+1)(2b+7)\mid  (7b+2)(b+1)\implies 2b+7\mid 7b+2$$
we have $$2b+7\mid (7b+2)-3(2b+7) = b-19$$
so if $b-19> 0$ we have $$2b+7\mid b-19 \implies 2b+7\leq b-19 \implies b+26\leq  0$$
which is not true. So $b\leq 19$. By trial and error we see that $b=4$ and $b=19$ works.
A: $$2B^2+9B+7\mid 7B^2+9B+2$$
Let's write $aB^2+bB + c$ as $[a,b,c]_B$ to emphasis that $a,b,c$ are digits base $B$.
Then $[2,9,7]_B \mid [7,9,2]_B-[2,9,7]_B$ and we are assuming that $2,9,7 < B$
Writing this out "subtraction-style", we get
$\left.\begin{array}{c}
    & 7 & 9 & 2 \\
   -& 2 & 9 & 7 \\
  \hline
\phantom{4}
\end{array}
\right.
\implies
\left.\begin{array}{c}
    & 6 & (B+8) & (B+2) \\
   -& 2 &     9 &     7 \\
  \hline
    & 4 & (B-1) & (B-5)
\end{array}
\right.
$
So $[4,B-1,B-5]_B$ is a multiple of $[2,9,7]_B$.
We must therefore have $[4,B-1,B-5]_B = 2[2,9,7]_B = [4,18,14]_B$ which implies $B-1=18$ and $B-5=14$. Hence $B=19$.
