0

I know that 27 satisfies that requirement in the title:

$$72\cdot\frac{3}{8}=27$$

However, I've obtained this solution by a short python script checking all 2-digit numbers. How can I do better and find it fast by hand?


For those interested in the script itself:

import numpy as np
two_digit_numbers=np.arange(10,100)

def swap(number): number_string = repr(number) new_number_string = number_string[1]+number_string[0] new_number = int(new_number_string) return new_number

for number in two_digit_numbers: if number*8/3 == swap(number): print(number)

zabop
  • 1,011
  • 1
    Well, the bigger number must be divisible by $8$, and the smaller by $3$, hence the larger must be divisible by $24$. – lulu May 05 '21 at 20:44
  • Oh ok that's good, thx. – zabop May 05 '21 at 20:44
  • Your short Python script used two variables to contain the two digits. How did you combine those to get a number? Is there a reason you can't do the same thing algebraically? – Eric Towers May 05 '21 at 20:45
  • 1
    I should have been clearer: the fact that the smaller one is divisible by $3$ means the larger one is also, hence the larger is divisible by $24$. So you really just have to check $4$ numbers. – lulu May 05 '21 at 20:45
  • Added the script @Eric – zabop May 05 '21 at 20:49
  • Thank you @lulu, would you like to add that as an answer? I find it great – zabop May 05 '21 at 20:49
  • Convincing someone your code handles the digits correctly is harder than actually having the digits in variables. See the two answers for how you should be thinking about digital problems. – Eric Towers May 05 '21 at 20:51
  • Yeah, thanks, I know it's not super ideal... Just wanted to get a quick initial answer, that's why I did it that way. – zabop May 05 '21 at 20:58

3 Answers3

4

$$8(10a+b)=3(10b+a)$$ or

$$77a=22b$$

or

$$7a=2b.$$

2

Write your number in digits as $10a + b$ where $a,b \in \{ 1, 2 , \dots , 9\}$. Then you're solving \begin{align} 10a + b = \frac{3}{8} (a + 10 b) \Leftrightarrow 80a + 8b = 3a + 33b \Leftrightarrow 77a = 22b \Leftrightarrow 7a = 2b, \end{align} and you can just read off $a=2$ and $b=7$ from there.

2

As an alternative method, note that the larger number must be divisible by $8$ and the smaller by $3$.

Now, as an integer is divisible by $3$ if and only if the sum of its digits is, it follows that the larger number is also divisible by $3$, hence by $24$.

Thus the larger number must be one of $\{24, 48, 72, 96\}$ and it is easy to test each case.

lulu
  • 70,402
  • Notice that as a little refinement, since the smaller number is less than $37<99\times \frac 38$, only $24$ and $27$ need to be tested. – zwim May 05 '21 at 21:18