It is very simple

    Consider the following problem. Find the fraction period 1/81. I assure you that neither a calculator nor division by a column will be required for the solution. To begin with, remember what is equal to 81 * (Period). Let the length of the period be n, then the initial fraction will be written as:


    $ \ frac {1} p = \ frac {Period} {10 ^ n} + \ frac {Period} {10 ^ {2n}} + \ frac {Period} {10 ^ {3n}} + ... $


    We rewrite this representation in the following form:


    $ \ frac {1} p = \ frac {Period} {10 ^ n} + \ frac {1} {10 ^ n} \ cdot \ left (\ frac {Period} {10 ^ {n}} + \ frac { Period} {10 ^ {2n}} + .. \ right) $


    The last expression can be represented as follows:


    $ \ frac {1} p = \ frac {Period} {10 ^ n} + \ frac {1} {10 ^ n} \ cdot \ frac {1} p $


    Well, now the ratio we were looking for:


    $ p \ cdot Period = 10 ^ n-1 $


    For our case, this identity will be as follows:


    $ 81 \ cdot Period = 10 ^ n-1 $


    Divide the left and right sides by 9, we get:


    $ 9 \ cdotPeriod = 111 ... 111 $


    The first number, made up of one unit, which is divided by 9, is 111111111, this follows from the sign of divisibility by 9. We will divide by the sum of the digits of the original number . We move from left to right, add the numbers of the dividend and at each step we record the amount received. The result of this algorithm is the number 12345678,9999 ... Here it is necessary to clarify that when we reach the rightmost digit, we put a comma and the resulting sum of the digits of the original number is duplicated as an infinite decimal fraction. We recall that 0.999 ... = 1 and we get the answer we were looking for 12345679. If we consider the more general problem of finding the fraction period$ \ frac {1} {9 ^ n} $, it turns out that the period of such a fraction has a length $ {9 ^ {n-1}} $ and if the period for the case n-1 is known, then the next one is the product of this period by a number of the form 11111 ... (repeated $ {9 ^ {n-1}} $ times) 22222 ... (repeated $ {9 ^ {n-1}} $ times) 33333 ... (repeated $ {9 ^ {n-1}} $time). The rightmost section will look like 8888..889. The last digit is nine.
    And one more observation, now for fractions of the form$ \ frac {1} {11 ^ {n}} $. In this case, the period length is$ 2 \ cdot {11 ^ {n-1}} $. And if the period for the case n-1 is known, then the next period is equal to the product of this period by a number made up of 10 blocks, where the length of each block$ 2 \ cdot {11 ^ {n-2}} $. Blocks have the following structure:
    09090909 ...
    18181818 ...
    27272727 ...
    36363636 ...
    ...
    last block 90909091. For$ \ frac {1} {11} $ period 09, for $ \ frac {1} {11 ^ {2}} $the period will be 09182736455463728191 * 9 = 0082644628099173553719.
    Checked the formula for$ \ frac {1} {11 ^ {3}} $. Got


    75131480090157776108189331329827197595792637114951164537941397445529676934635612
    32156273478587528174305033809166040570999248685199098422238918106686701728024042
    0736288504883546205860255447032306536438767843726521412471825694966190833959429,


    which coincides with the period without leading zeros.


    I will give the code of the procedures that I used to check my conclusions.


    Function GreatestCommonDivisor(x,y)
        if x=y then
            return x;
        endif;  
        a=min(x,y);
        if a=1 then
            return 1;
        endif;  
        b=x+y-a;
        while TRUE do
         c=b%a; 
         if c=0 then
             return a;
         endif;  
         b=a;
         a=c;
        enddo;
    EndFunction
    Function NumeratorFractionPeriod(numerator,denumerator)
        // дробь a/b
        a=numerator;
        b=denumerator;
        while b%2=0 do
            b=b/2;
            a=a*5;
        enddo;  
        while b%5=0 do
            b=b/5;
            a=a*2;
        enddo;  
        //наибольший общий делитель
        c=GreatestCommonDivisor(a,b);
        a=a/c;
        b=b/c;
        if b=1 then
            Period=string(a);
            return Period;
        endif;
        if a>b then
            Period=string((a-a%b)/b);
            a=a%b;
            if a=0 then
                return Period;
            endif;  
            Period=Period+"(";
        else
            Period="(";
        endif;      
        while a%10=0 do
            a=a/10;
        enddo;  
        i=a;
        while TRUE do
            j=0;
            while i1 then
                 Period=Period+"0";
                endif; 
            enddo;  
            check=i-a;
            if (check%b)=0 then
                Period=Period+(check)/b;
                break;
            else
                j=i%b;
                Period=Period+(i-j)/b;
                i=j;
            endif;    
        enddo;
        return Period+")";
    EndFunction 

    Also popular now: