How many 3-digit positive integers N are there such that if M is the integer obtained by reversing the digits of N , then
M = 3 8 2 7 N ?
This problem is posed by Daniel W .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I thought, Let N = a b c so M = c b a we get, N − M = 9 9 ( a − c ) ⟹ N − ( 2 7 / 3 8 ) N = 9 9 ( a − c ) ⟹ N = 9 ⋅ 3 8 ⋅ ( a − c ) As, N is 3 digit, ( a − c ) can be 1 or 2 that gives N = 9 ⋅ 3 8 ⋅ 1 = 3 4 2 and 9 ⋅ 3 8 ⋅ 2 = 6 8 4 No guessing needed ;)
Log in to reply
Nice solution!
Great!
I don't really understand what the symbol stands for.
Such a simple yet thoughtful solution. Great job..
danielIntegerReversal.c
#include <stdio.h>
int reverse(int n) {
int result = 0;
while (n > 0) {
result = result * 10 + n%10;
n = n/10;
}
return result;
}
int main(char* args, int nArgs) {
int n,results = 0;
float m,condition = 0;
for (n=100; n < 1000; n++) {
m = (float) reverse(n);
condition = n*(27/38.0);
if (condition == m) {
printf("m=%f %d*(27/28)=%f !\n",
m,
n,
condition);
results++;
}
}
printf("found %d numbers.\n",results);
}
m=243.000000 342*(27/28)=243.000000 !
m=486.000000 684*(27/28)=486.000000 !
found 2 numbers.
In python:
numbs = [i for i in range(100,1000)]
for i in range(0,900):
x = str(numbs[i])
new_num = ""
new_num = new_num + x[2]
new_num = new_num + x[1]
new_num = new_num + x[0]
if 38*int(new_num) == 27*numbs[i]:
count = count + 1
print(count)
which prints 2...
Log in to reply
ha, custom made reverse using str() and int(). not very elegant, but works.
from the text of the question you will figure out that "m/n=27/38" ===> 100x+10y+z/100z+10y+x=27/38 ( Without any Problem! :-) ) so: 2700z+270y+27x=3800x+380y+38 ====> 3773x+110y=2662z ====><devide by 11> 343x+10y=242z and then you can guess the numbers(That I think is not very good idea! ) or continue...
Finally The nums whould be 342 & 684. >>>>2 is the answer.
M is an integer so N is a multiple of 3 8 . M is a multiple of 2 7 and hence N is a multiple of 9 because the digit sum will be the same.
Clearly N is a multiple of 2 , 9 , and 1 9 so N is either 3 4 2 or 6 8 4 and it can be quickly verified that both of these values of N will generate values of M that follow the rules as given, so the answer is 2
Problem Loading...
Note Loading...
Set Loading...
2 7 ∣ M ⟹ 9 ∣ M ⟹ 9 ∣ S ( M ) = S ( N ) , where S ( x ) denotes the digit sum of x . Also, 9 ∣ S ( N ) ⟹ 9 ∣ N ⟹ 9 ⋅ 3 8 = 3 4 2 ∣ N , as 3 8 ∣ N . We obtain that N ∈ { 3 4 2 , 6 8 4 } ⟹ ( M , N ) ∈ { ( 2 4 3 , 3 4 2 ) , ( 4 8 6 , 6 8 4 ) } , of which both pairs satisfy the constraints.