<s>[INST] 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?
 [/INST] $$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$.
</s>