The longest repeating decimal that can be created from a simple fraction

Solution 1:

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.

Solution 2:

Several answer indicate that you must look for the largest full-repetend prime lower than your upper limit for the denominator. Since every number that is coprime to the base (but not necessarily prime) has a repetend and not every prime has a full repetend it is possible that a non-prime will hold the distinction of having the longest repentend in that range.

In base 10 only the squares 289 and 361 have the longest repetend up to their value...at least up to $10^8$. So for limits above 361 (and certainly below $10^8$ but only with diminishing probability at higher values) the "full repetend prime" is the right answer.

But in general it appears that one must check all numbers that are coprime to the base and not only primes. For example, in base 8 (below 11467) the repetend for $107^2$ with length 5671 is the longest.