9

Problem: A decimal number $z$ of 8 digits after decimal Point is given.How can $x,y$ be found such that the first 8 digits of $\frac{x}{y}$ are same as $z$ (one may ignore digits after first 8 digits ) ?

Decimal Point is a point or dot used to separate the whole number part from the fractional part of a number. Restrictions are-

  1. $x,y$ have no rational or irrational number common as a factor in $x,y$ , i.e. their Greatest Common Divisor is $1$.

  2. $x,y$ could be irrational*.

  3. $y$ is not a power of $10$.

  4. find the smallest possible $x,y$ , if possible.

Example: Consider the number, $0.29411764705882352941176470588235$ as $z$.

Here, The first 36 digits of $\frac{5}{17}$ are $29411764705882352941176470588235$.

So, $x=5, y=17$. So, if $0.29411764705882352941176470588235$ is given, is there an algorithm which can find $5,17$ ?.

*Note: The problem considers the first 8 digits after decimal point. So, if $\frac{x}{y}$ is infinite after decimal point, but has first 8 digits same as $z$, after decimal point , the solution is acceptable, that is why $x,y$ could be irrational.

Related Post: This post is related but does not help much.

Michael
  • 547

3 Answers3

5

As Raymond Manzoni suggested in his comment, the best approximation of a decimal number can usually be achieved by transforming it into a continuous fraction. I'll try to explain how that works with an example.

Let's take $z=0.29411764$, as you suggested, and compute its reciprocal $1/z=3.4000000816$. The integer part of this number ($3$) is the first term in the continuous fraction expansion, and $z=1/3$ is the first approximation.

Consider now the fractional part of $1/z$, that is $0.4000000816$, and compute its reciprocal $2.4999994900001$. The integer part ($2$) is the second term in the continuous fraction expansion and $z=1/(3+1/2)$ is thus the second approximation. The remaining fractional part is $0.4999994900001$, whose reciprocal is $2.00000204000168$: this gives $2$ as the third term in the continuous fraction expansion, leading to $z=1/(3+1/(2+1/2))$. The fractional remainder $0.00000204000168$ is very small: that means that the approximation we have reached is very good. Indeed you may check that $$ {1\over\displaystyle3+{1\over2+{1\over2}}}={5\over17}. $$

This example suggests a possible strategy: compute the continuous fraction expansion of $z$ until you get a small remainder. This works well if $z$ is the truncated decimal representation of a fraction having small integers as numerator and denominator.

If, on the other hand, $z$ is the square root of such a fraction, then no small remainder will be obtained, and the terms of the continuous fraction will show a periodic pattern. In that case one may compute the continuous fraction expansion of $z^2$ to get an approximated fraction $a/b$, so that $z=\sqrt{a}/\sqrt{b}$.

Example: $z=1.29099445=1+0.29099445$. The reciprocal of the fractional part is $3.43649165817424=3+0.43649165817424$ and again the reciprocal of the fractional part is $2.29099452709545=2+0.29099452709545$. Notice that the last remainder is very close to the first one: if you continue with the expansion you'll get a (quasi-) periodic continued fraction: $$ z=1+\cfrac{1}{2+\cfrac{1}{3+\cfrac{1}{2+\cfrac{1}{3+\dots}}}} $$ This is not exactly periodic because of the limited precision, but you are not going to obtain a small remainder in a few cycles.

Let's try then $z^2=1.6666666699308=1+0.6666666699308$. We get in turn $1.4999999926557=1+0.4999999926557$ and $2.0000000293772=2+0.0000000293772$. The fractional remainder is small, so that we can stop with: $$ z^2=1+\cfrac{1}{1+\cfrac{1}{2}}=\frac{5}{3}, \quad\hbox{and}\quad z=\frac{\sqrt5}{\sqrt3}. $$

1

This answer was written when the question did not have points $1$ and $4$ mentioned in the list of constraints for $x$ and $y$. For the current question, it is no longer valid.


Let $$z=0.abcdefgh$$ If initially $|z|>1$, we ignore the integer part and if $z<0$, we take the absolute value.

Now, consider $$\frac{x}{y}=\frac{abcdefgh}{100000000}$$

If $x,y$ can be rational, then simply take $$x=2\times abcdefgh$$ and $$y=200000000$$

If $x,y$ must be irrational, then take $$x=\pi\times abcdefgh$$ and $$y=100000000\pi$$

or any other irrational number in place of $\pi$.

GoodDeeds
  • 11,405
1

If your number is $0.abcdefgh...$ then consider $\frac{abdcefgh2}{1000000000}$
Then cancel it and y will not be a power of 10