Consider the following problem. Find the fraction period 1/81. I assure you that the solution will not require neither a calculator nor a column division. For a start, remember what is 81 * (Period). Let the length of the period n, then the initial fraction is written as:
Rewrite this view as follows:
The last expression can be represented as:
Well, now the ratio we were looking for:
For our case, this identity will be as follows:
Divide the left and right side by 9, we get:
The first number made up of one units, which is divided by 9 is 111111111, which follows from the sign of divisibility by 9. We divide by the sum of digits of the original number . We move from left to right, add the digits of the dividend and at each step write the resulting amount. The result of this algorithm is the number 12345678.9999 ... Here we must clarify that when we reach the extreme right digit, we put a comma and duplicate the resulting amount of digits of the initial number as an infinite decimal fraction. We recall that 0.999 ... = 1 and we get the answer that we were looking for 12345679. If we consider the more general problem of finding the fraction period then it turns out that the period of such a fraction has a length and if the period is known for the case n-1, then the next is equal to the product of this period by the number of the form 11111 ... (repeats times) 22222 ... (repeated times) 33333 ... (repeated time). The rightmost section will be 8888..889. The last figure is nine.
And one more observation, now for fractions of the form . In this case, the period length is equal to . And if the period is known for the case of n-1, then the next period is equal to the product of this period by a number composed of 10 blocks, where the length of each block . The blocks have the following structure:
09090909 ...
18181818 ...
27272727 ...
36363636 ...
...
the last block is 90909091. For period 09, for the period will be 09182736455463728191 * 9 = 0082644628099173553719.
Checked the formula for . Received
75131480090157776108189331329827197595792637114951164537941397445529676934635612
32156273478587528174305033809166040570999248685199098422238918106686701728024042
0736288504883546205860255447032306536438767843726521412471825694966190833959429,
which coincides with the period without leading zeros.
I will give the code of the procedures that I used to verify 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+ya; 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((aa%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 i<b do i=i*10; j=j+1; if j>1 then Period=Period+"0"; endif; enddo; check=ia; if (check%b)=0 then Period=Period+(check)/b; break; else j=i%b; Period=Period+(ij)/b; i=j; endif; enddo; return Period+")"; EndFunction
Source: https://habr.com/ru/post/326110/
All Articles