We are given that
2 * (a + b) = 5 * (b  1)
Working with this equation, we have :
3b  2a = 5........(eq. 1)
From this we can conclude that :
a = 1.5b (approximately, since a and b are 4digit numbers).....(eq. 2)
If we represent the smaller 4digit number b by the string pxyq, then the larger 4digit number a is the string qyxp.
The equation (2) places restrictions on the combinations of first and last digits p and q that our numbers a and b can have.
The following table lists all the possible 4digit combinations for the numbers a and b based on the restrictions imposed by equation (2) above:
b a

1xy2 2yx1
2xy3 3yx2
2xy4 4yx2
3xy4 4yx3
3xy5 5yx3
4xy6 6yx4
4xy7 7yx4
5xy7 7yx5
5xy8 8yx5
6xy9 9yx6
For any of the above possibilities we have, from equation (1)
above, the following:
3b  2a = 5
or
3 * (1000p + 100x + 10y + q)  2 * (1000q + 100y + 10x + p) = 5 300x + 30y + 3 * (1000p + q)  200y  20x  2 * (1000q + p) = 5
which we can rearrange as
(280x  170y) + 3000p  2000q = 2p  3q + 5......(eq. 3)
The variables p, q, x, and y are all singledigit positive integers, so the lefthand side of this equation is divisible by 10. So, the righthand side of the equation must therefore also be divisible by 10.
The table above shows all the possible combinations of digits p and q;
let's find which of those combinations satisfy the condition that (2p  3q + 5) is divisible by 10:
p q (2p  3q + 5)

1 2 2  6 + 5 = 1
2 3 4  9 + 5 = 0
2 4 4  12 + 5 = 3
3 4 6  12 + 5 = 1
3 5 6  15 + 5 = 4
4 6 8  18 + 5 = 5
4 7 8  21 + 5 = 8
5 7 10  21 + 5 = 6
5 8 10  24 + 5 = 9
6 9 12  27 + 5 = 10 So now there are only two possibilities for the digits p and q:
(p,q) = (2,3)
or
(p,q) = (6,9)
Now let's try each of these two possibilities in equation (3) above,
remembering that p, q, x, and y are singledigit integers.
(280x  170y) + 3000p  2000q = 2p  3q + 5
For (p,q) = (2,3) we find :
280x  170y + 6000  6000 = 4  9 + 5 = 0 280x  170y = 0 28x  17y = 0
The only solution in singledigit integers for this equation is (x,y) = (0,0); this gives us one solution to the problem :
p = 2 , q = 3, x = y = 0.
We have :
b = 2003 a = 3002
Checking :
2 * (3002 + 2003) = 5 * (2003  1) 2 * 5005 = 5 * 2002 10010 = 10010
For (p,q) = (6,9) we find :
280x  170y + 18000  18000 = 12  27 + 5 =  10 280x  170y =  10 28x  17y =  1
We now solve this as a diophantine equation with x and y singledigit integers:
17y = 28x + 1 17y = 17x + 11x + 1 y = x + (11x + 1)/17
The expression (11x + 1) must be divisible by 17; trying singledigit integer values for x, we have :
11 * 1 + 1 = 12 11 * 2 + 1 = 23 11 * 3 + 1 = 34
34 is divisible by 17. So we now have :
x = 3 y = 3 + (34/17) = 3 + 2 = 5.
And we find a second solution to the problem:
p = 6, x = 3, y = 5, q = 9.
We have:
b = 6359 a = 9536
Checking:
2 * (9536 + 6359) = 5 * 6358 2 * 15895 = 5 * 6358 31790 = 31790
Thus we have two solutions to the problem:
(a,b) = (3002,2003)
and
(a,b) = (9536,6359)
