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