Is there any way (hopefully a ‘simple’ way if I’m going to understand it) to determine if for a given prime §, the decimal expansion of its reciprocal (1/p) repeats with length p-1?

For example, for the prime 7, the decimal expansion of its reciprocal, 1/7, is .142857142857142857 . . . i.e. 142857 repeating, the repeating set of digits thus having length 7-1 which equals 6.

Likewise, for the prime 17, the decimal expansion of its reciprocal, 1/17, is .058823529411764705882352941176470588235294117647 . . . i.e. 0588235294117647 repeating, the repeating set of digits thus having length 17-1 which equals 16.

On the other hand, for the prime number 13, the decimal expansion of its reciprocal, 1/13, is .076923076923076923 . . . i.e. 076923 repeating, the repeating set of digits having length 6, which is *not* equal to 13-1.

In other words, for some primes, their reciprocals’ decimal expansion consist of a sequence of p-1 digits repeating, whereas for other primes the decimal expansion of their reciprocals consists of a repeating sequence of length less than p-1 (i.e. evidently of length (p-1)/k for some integer k)

Last November, we had a thread about the decimal expansion of 1/7. In the discussion that ensued, there was mention of cyclic numbers which seem to be of relevance here, but the question I am asking was not addressed.

So, my question again: For a given prime number p, is there any way to determine if the decimal expansion of its reciprocal (1/p) repeats with length p-1?

Thanks!