# What's the largest possible repeating decimal that can be created from a fraction (if n <= 9,999 & d <= 9,999)

What's the largest possible repeating decimal that can be created from a fraction if:

• The numerator has to be less than or equal to 9,999
• The denominator has be less than or equal to 9,999?

I know the repeating decimal part can't exceed the denominator - 1. So the longest possible repeating decimal part has to be 9,998 or less.

The reason I want to know is to test an algorithm that I wrote which accepts fractions with numerators and denominators up to 9,999. The largest repeating decimal part I was able to create so far was 1/97 which equaled 0.[01030927 83505154 63917525 77319587 62886597 93814432 98969072 16494845 36082474 22680412 37113402 06185567] (96 repeating digits).

-
Could you explain what you mean by the largest possible repeating decimal? Because all fractions will produce a repeating decimal and the largest would therefore be 9999/1 = 9999. Do you mean the longest period of repetition? – Sam DeHority Jan 27 '13 at 1:28
I mean the longest period of repetition. For 1/97 I get 96 repeating digits. – user1822824 Jan 27 '13 at 1:30
I'm looking for a fraction that will create a period of repetition of 9,998 repeating digits? – user1822824 Jan 27 '13 at 1:32
If you want a fraction with a period of exactly $9998$, then you need to find a denominator which divides $10^{9998}-1$ and doesn't divide $10^r-1$ for any $r$, $1\le r\le9997$. Theory guarantees there are some, but they may have hundreds or thousands of digits. – Gerry Myerson Jan 27 '13 at 3:49

The numerator doesn't matter (for this question), so you might as well let it be $1$. The denominator should be the largest prime under $10000$ which has $10$ as a primitive root. I don't know offhand what that prime is, but I'm sure such primes are tabulated and shouldn't be hard to locate.

The table at the Online Encyclopedia doesn't go far enough. There is an applet which claims to find these primes, but I couldn't make it work --- maybe you'll have better luck.

-
I just did 1/9973 and got 0.[00010027073097362879775393562619071493031184197332798556101473979745312343326‌​982853705003509475584077007921387746916675022560914469066479494635515892910859320‌​164443998796751228316454426952772485711420836257896320064173267823122430562518800‌​762057555399578862929910759049433470369998997292690263712022460643738092850696881‌​580266720144389852602025468765667301714629499649052441592299207861225308332497743‌​908553093352050536448410708914067983555600120324877168354557304722751428857916374‌​210367993582673217687756943748119923794244460042113707008924095056652963] --- 554 repeati – user1822824 Jan 27 '13 at 1:38
I found this list of primes... primes.utm.edu/lists/small/10000.txt – user1822824 Jan 27 '13 at 1:39
1/9967 would be the largest, producing a period of 9966. – Sam DeHority Jan 27 '13 at 1:43
@DoctorBatmanGod: Please don't make edits that change the meaning of the post, unless it is marked Community Wiki. – Rahul Jan 27 '13 at 1:52

1/9801= 0.010203040506070809010111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697990010203..., about 100 repeating digits

-
since each number is represented by two digits (01, 02, 03...) and every number to 99 is represented, that's 99x2 + 1 (for the final zero). That's 199 repeating digits. – Madivad Dec 31 '14 at 11:32

You can find more details on on my main web page at “engert.us/erwin/Miscellaneous.html” where I have a listing of repeating digits for all odd numbers under 28,000. I also have a listing of prime numbers with how many repeating digits hey have in “engert.us/erwin/miscellaneous/Reciprocals%20of%20prime%20numbers.pdf. For your interest here a just a few of the numbers under 9,999 they are: 1/9871, 4935 1/9883, 4941 1/9887, 9886 1/9901, 12 1/9907, 4953 1/9923, 4961 1/9929, 1241 1/9931, 9930 1/9941, 1988 1/9949, 9948 1/9967, 9966 1/9973, 554 Erwin

-