The decimal expansion of 1/271 repeats with a period of length 5:

.003690036900369 ...

However, it is not the smallest number q for which the decimal expansion of 1/q has a repetition length of 5.

Find the smallest q so that the decimal expansion of 1/q has repetition length n for each of {1, 2, ..., 10}

Is there a simple way of finding such a number?

(In reply to

re: General solution by Jer)

Right, I went for prime numbers, while smaller composite numbers may also produce the same period length.

For example, for D=3: 10^3-1 equals 3^3 times 37; since 3^3<37, 27 is the first number such that 1/27 has a period length of 3.

*Edited on ***September 26, 2006, 12:38 pm**