# 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?

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$$.

• Thank you so much. This was really very helpful. :) – Aamir Khan Dec 31 '18 at 20:37
• My pleasure, glad to help. – vadim123 Dec 31 '18 at 20:39
• @AamirKhan Beware that the above is not a rigorous solution without proof that those are the only possible quotients. See my answer for one rigorous approach – Bill Dubuque Dec 31 '18 at 21:26
• @BillDubuque, it's not difficult to make it rigorous, to prove that the quotient $q$ can't be bigger than $3$. $(2q-7)B^2+(9q-9)B+(7q-2)$ is strictly positive if $q\ge 4$ and $B>0$. Hence if $q\ge 4$, no positive $B$ solves the equation. Similarly, if $q=1$, then the only positive solution is $B=1$, which is not possible. – vadim123 Dec 31 '18 at 21:48
• @vadim You should add the details of a rigorous proof to the answer (I've lost count of the number of times "[this case] doesn't make sense" turned out to be incorrect), so we should not encourage students to handwave like that. – Bill Dubuque Dec 31 '18 at 21:58

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.$$

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.

$$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$$.