# Numeric facts on fractions, that few are aware of.

Assume a fraction k/m, with 0≤k≤m and look at its digits written out

1. The fraction has a finite number of digits (less m) OR is a repeated sequence with at the most m-1 digits per group
2. A repeated sequence will have at the most n-1 zeroes next to each other, if the number is below 10ⁿ
3. Interesting digit-structure of the sequence times m, with many 9’s (base minus 1) .

It is surprisingly simple to prove

1. Any division j/m can have reminders 0..m-1, so doing the calculus k/m one digit at the time will either stop or get the same reminder at step m or earlier.
2. The least reminder doing the repeated sequence is 1, so 10/m will give a zero if and only if 10<m, and the next can be zero if and only if 100<m, et cetera
3. The sequence multiplied with m will often have an interesting digit-structure, where the first and last digits added will give 10ⁿ-1 for some n. and 9s between.
As an example (in base ten) for 1/272 = 0.0036(7647058823529411)+ here the product is  2079999999999999792  (where 207+792=999 obviously).
This is not unexpected, as summing op the digits after multiplying should end as 0.999999…
Its digit-sequence does not always contain 9s though, as an example 1/96 = 0.01041(6)+ where the product is 576

Here a little piece of code to explore

```int k = 1;  // for k/m for various 1&amp;amp;amp;amp;amp;lt;m
for (int m = 2; m&amp;amp;amp;amp;amp;lt;=1111; m++) {
int r= k;
System.Numerics.BigInteger kTimes10to_d = k;
List&amp;amp;amp;amp;amp;lt;int&amp;amp;amp;amp;amp;gt; rem = new();
int ix;
int d = 0; //number of digits used
do { // the division digit by digit, until repeated remainder (incl zero)
d++;
kTimes10to_d*=10;
r=(int)(kTimes10to_d % m); //less than m so plain int
}
while ((ix=rem.IndexOf(r))&amp;amp;amp;amp;amp;lt;0); // new remaindier?
System.Numerics.BigInteger f = (kTimes10to_d-r)/m; //r was last remainders of q/m
int leadlen = ix; //First time the repeated reminder reoccurs is ix steps in
System.Numerics.BigInteger tenToReplen = 1;
for (int i = 0; i&amp;amp;amp;amp;amp;lt;replen; i++) tenToReplen*=10; // 10^replen
System.Numerics.BigInteger rep = (tenToReplen-1)*r/m; // we know this is integral
System.Numerics.BigInteger lead = (f-rep)/tenToReplen; //clip the repeated tail.
// (hack: C# D0 does not give empty string, so one extra and drop afterwards)
string reps = rep.ToString("D"+replen.ToString()); //leading zeroes
//Strictly the conditional part is superfluous 1/4=0.25(0)+ is not wrong.
}

```

(Where one can easily output rep*m also to study the digit-structure)

Obviously this in not base dependant, in 3. replace “9” with (base-1) in general, e.g “F” for hex. And “10” with base.

The first can also be used the other way round. A decimal number with repeated digit-group of length j can not be an integer fraction k/m unless j<m.
Here j can be upper bound as well assuming a lead with L decimals before the repetition the number is (lead+Sequence/(10^j -1)/10^L ), so the dividend must be a divisor in (10^j -1)*10^L. (e.g.  12.3456456456456… three digits repeated started one decimal in, so 999*10 is a possibility :  12.3+456/9990 = 123333/9990 = 41111/3330)

Note that it is NOT the case that a a prime divisor will give a long repeated sequence, take e.g. 1/37=0.(027)+ with just three digits repeated, as 37 is a divisor in 10³-1 (=27*37)

Some ‘pretty’ ones:

1/3 = 0.(3)+

1/30 = 0.0(3)+
1/33 = 0.(03)+

1/300 = 0.00(3)+
1/303= 0.(0033)+
1/330 = 0.0(03)+
1/333 = 0.(003)+

1/3000 = 0.000(3)+
1/3003 = 0.(000333)+
1/3030 = 0.0(0033)+
1/3300 = 0.00(03)+
1/3330 = 0.0(003)+
1/3333 = 0.(0003)+

1/30000 = 0.0000(3)+
1/30003 = 0.(00003333)+
1/30030 = 0.0(000333)+
1/30300 = 0.00(0033)+
1/30303 = 0.(000033)+
1/33000 = 0.000(03)+
1/33300 = 0.00(003)+
1/33330 = 0.0(0003)+
1/33333 = 0.(00003)+

1/300000 = 0.00000(3)+
1/300003 = 0.(0000033333)+
1/300030 = 0.0(00003333)+
1/300300 = 0.00(000333)+
1/303000 = 0.000(0033)+
1/303030 = 0.0(000033)+
1/330000 = 0.0000(03)+
1/330033 = 0.(00000303)+
1/333000 = 0.000(003)+
1/333300 = 0.00(0003)+
1/333330 = 0.0(00003)+
1/333333 = 0.(000003)+

On the other hand numbers like 1/3033 and 1/3303 and are not ‘pretty’, What matter is that we by sums of 3×10^i for some i combination can get  10ⁿ-1. e.g. 330033*303 = 99999999,

Equally pretty if you multiply or divide by 3 obviously.
You will get the same forms with 1s on one side and 9s on the other.