Saturday, October 8, 2016

How do we find a fraction with whose decimal expansion has a given repeating pattern?



We know $\frac{1}{81}$ gives us $0.\overline{0123456790}$



How do we create a recurrent decimal with the property of repeating:



$0.\overline{0123456789}$



a) Is there a method to construct such a number?




b) Is there a solution?



c) Is the solution in $\mathbb{Q}$?



According with this Wikipedia page: http://en.wikipedia.org/wiki/Decimal
One could get this number by applying this series. Supppose:



$M=123456789$, $x=10^{10}$, then $0.\overline{0123456789}= \frac{M}{x}\cdot$ $\sum$ ${(10^{-9})}^k$ $=\frac{M}{x}\cdot\frac{1}{1-10^{-9}}$ $=\frac{M}{9999999990}$




Unless my calculator is crazy, this is giving me $0.012345679$, not the expected number. Although the example of wikipedia works fine with $0.\overline{123}$.



Some help I got from mathoverflow site was that the equation is: $\frac{M}{1-10^{-10}}$. Well, that does not work either.



So, just to get rid of the gnome calculator rounding problem, running a simple program written in C with very large precision (long double) I get this result:



#include  
int main(void)
{
long double b;

b=123456789.0/9999999990.0;
printf("%.40Lf\n", b);
}


Result: $0.0123456789123456787266031042804570461158$



Maybe it is still a matter of rounding problem, but I doubt that...



Please someone?




Thanks!



Beco



Edited:



Thanks for the answers. After understanding the problem I realize that long double is not sufficient. (float is 7 digits:32 bits, double is 15 digits:64 bits and long double is 19 digits:80 bits - although the compiler align the memory to 128 bits)



Using the wrong program above I should get $0.0\overline{123456789}$ instead of $0.\overline{0123456789}$. Using the denominator as $9999999999$ I must get the correct answer. So I tried to teach my computer how to divide:




#include 
int main(void)
{
int i;
long int n, d, q, r;
n=123456789;
d=9999999999;
printf("0,");
n*=10;

while(i<100)
{
if(n {
n*=10;
printf("0");
i++;
continue;
}
q=n/d;

r=n%d;
printf("%ld", q);
if(!r)
break;
n=n-q*d;
n*=10;
i++;
}
printf("\n");
}


Answer



Suppose you want to have a number $x$ whose decimal expansion is
$0.a_1a_2\cdots a_ka_1a_2\cdots a_k\cdots$. That is it has a period of length $k$, with digits $a_1$, $a_2,\ldots,a_k$.



Let $n = a_1a_2\cdots a_k$ be the integer given by the digits of the period. Then
$$\begin{align*}
\frac{n}{10^{k}} &= 0.a_1a_2\cdots a_k\\
\frac{n}{10^{2k}} &= 0.\underbrace{0\cdots0}_{k\text{ zeros}}a_1a_2\cdots a_k\\
\frac{n}{10^{3k}} &= 0.\underbrace{0\cdots0}_{2k\text{ zeros}}a_1a_2\cdots a_k\\

&\vdots
\end{align*}$$
So the number you want is
$$\sum_{r=1}^{\infty}\frac{n}{10^{rk}} = n\sum_{r=1}^{\infty}\frac{1}{(10^k)^r} = n\left(\frac{\quad\frac{1}{10^k}\quad}{1 - \frac{1}{10^k}}\right) = n\left(\frac{10^k}{10^k(10^k - 1)}\right) = \frac{n}{10^k-1}.$$
Since $10^k$ is a $1$ followed by $k$ zeros, then $10^k-1$ is $k$ 9s. So the fraction with the decimal expansion
$$0.a_1a_2\cdots a_ka_1a_2\cdots a_k\cdots$$
is none other than
$$\frac{a_1a_2\cdots a_k}{99\cdots 9}.$$



Thus, $0.575757\cdots$ is given by $\frac{57}{99}$. $0.837168371683716\cdots$ is given by $\frac{83716}{99999}$, etc.




If you have some decimals before the repetition begins, e.g., $x=2.385858585\cdots$, then first multiply by a suitable power of $10$, in this case $10x = 23.858585\cdots = 23 + 0.858585\cdots$, so $10x = 23 + \frac{85}{99}$, hence $ x= \frac{23}{10}+\frac{85}{990}$, and simple fraction addition gives you the fraction you want.



And, yes, there is always a solution and it is always a rational.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...