Find x and y. X/y=0.4285714286 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find x and y. X/y=0.4285714286

If we divide two numbers we get their quotient similarly is it possible to find that two numbers with its resultant (quotient)? Like 5/3 =1.6666666666 is it possible to find 5 and 3 with 1.666666666, can we reverse compute these numbers?

20th Apr 2019, 6:30 PM
George
George - avatar
3 Answers
+ 5
for i in range(1, 25): for j in range(1, 25): if abs(i/j-0.4285714286) <= 1e-10: print(f'{i}/{j}') # 3/7 exit()
20th Apr 2019, 7:40 PM
Anna
Anna - avatar
+ 1
It is possible if the numerator and denominator aren't large. Also, you may get multiple results due to precision.
20th Apr 2019, 9:50 PM
Diego
Diego - avatar