Number theory question maximum possible difference between $a$ and $b$

85 Views Asked by At

$1287a 45b$ is a 8-Digit number, where $a$ and $b$ are not zero. The number is divisible by 18. What is the maximum possible difference between $a$ and $b$?

My solution: I first said since it's divisible by 18, it's also divisible by 9 and 2, and since its divisible by 9, the sum of its digits is divisible by 9 so $$a + 27 + b $$ is divisible by 9. Now how do I carry on?

2

There are 2 best solutions below

3
On BEST ANSWER

You have done most it. Also, $b$ is even, and $9 | a+b$. And we need to maximize $a-b$ therefore, taking the largest possible $a$ and minimum possible $b$, we get $7-2 = \boxed{5}$ as $a,b \not=0$.

0
On

The eight digit number is divisible by 18=2.3^2. We therefore need it to be

(i) divisible by 2, and

(ii) divisible by 9

(i) gives us that b is even

(ii) gives us that its digital sum is divisible by 9. The digital sum is 27+a+b, and with 27 divisible by 9 we thus have a+b divisible by 9.

Finally,the question requires that

(iii) "a and b are not zero".

If we interpret (iii) as "both of a and b must not be zero" then the optimum solution is 9, with a=9, b=0.

If we interpret (iii) as "neither of a nor b must be zero" then the optimum, solution is 7, with a=1, b=8.