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:
We rewrite this representation in the following form:
The last expression can be represented as follows:
Well, now the ratio we were looking for:
For our case, this identity will be as follows:
Divide the left and right sides by 9, we get:
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, it turns out that the period of such a fraction has a length 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 times) 22222 ... (repeated times) 33333 ... (repeated time). The rightmost section will look like 8888..889. The last digit is nine.
And one more observation, now for fractions of the form. In this case, the period length is. 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. Blocks have the following structure:
09090909 ...
18181818 ...
27272727 ...
36363636 ...
...
last block 90909091. For period 09, for the period will be 09182736455463728191 * 9 = 0082644628099173553719.
Checked the formula for. 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