Saturday, October 8, 2016

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



We know 181 gives us 0.¯0123456790



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



0.¯0123456789



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




b) Is there a solution?



c) Is the solution in 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=1010, then 0.¯0123456789=Mx (109)k =Mx11109 =M9999999990




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



Some help I got from mathoverflow site was that the equation is: M11010. 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¯123456789 instead of 0.¯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.a1a2aka1a2ak. That is it has a period of length k, with digits a1, a2,,ak.



Let n=a1a2ak be the integer given by the digits of the period. Then
n10k=0.a1a2akn102k=0.00k zerosa1a2akn103k=0.002k zerosa1a2ak


So the number you want is
r=1n10rk=nr=11(10k)r=n(110k1110k)=n(10k10k(10k1))=n10k1.

Since 10k is a 1 followed by k zeros, then 10k1 is k 9s. So the fraction with the decimal expansion
0.a1a2aka1a2ak

is none other than
a1a2ak999.



Thus, 0.575757 is given by 5799. 0.837168371683716 is given by 8371699999, etc.




If you have some decimals before the repetition begins, e.g., x=2.385858585, then first multiply by a suitable power of 10, in this case 10x=23.858585=23+0.858585, so 10x=23+8599, hence x=2310+85990, 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:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...