# Comments on Digits of reciprocals of primes

## Karl P (2004-12-13T10:29:27Z)

Yes I realised that my first point (at the bottom) is incorrect and what I really intended to say was that p is a divisor of that repunit and no shorter repunit.

I thought about the second part and this gave rise to a proof of what David wanted proving about k, without referring to quadratic residues.

I suspected the p-1 digit period, taken as an integer, is of the form of either

n*10^k - n

or

n*10^k + n

for some integer n with k or fewer (if p>10) digits and n ends in 1,3,7 or 9.
For p=7, n=143 and 142857=143000-143.

This implies what David wanted proving, except the part about whether the (k+1)st digit is 9 or 0.

I realised that the p-1 digit period taken as an integer is
(10^(p-1)-1)/p. What I was suspecting is equivalent to saying that either
(10^(p-1)-1)/p = (10^k-1)*n
or
(10^(p-1)-1)/p = (10^k+1)*n .
but not both.

Noting that p-1 = 2*k, we have
(10^(p-1)-1) = (10^k-1)*(10^k+1).
So we have n equal to either
(10^k+1)/p or (10^k-1)/p .
Since p is a divisor of the product (10^(p-1)-1) and is prime, it must be a divisor of either (10^k+1) or (10^k-1)
and for p>2 not both. Hence either (10^k+1)/p or (10^k-1)/p is a whole number (which was called n). n must end in 1,3,7 or 9, because it is a divisor of such a number (10^(p-1)-1).

For p>11 this causes the (k+1)st digit of the decimal period to be either 9 or 0.

The same proof can be applied to all other bases.

The outstanding issue is for what values of p is p a divisor of (10^k+1)?

## Ruxor (2004-12-10T22:59:47Z)

Karl P → Concerning your repunit question, the answer is “no”: it is *always* true of a prime p that it divides the (p−1)-digit repunit (at least in any base b such that neither b nor b−1 are multiple of p); for example, 7 divides 111111, 11 divides 1111111111, 13 divides 111111111111, and so on. This follows readily from Fermat's “little” theorem (p divides b^(p−1)−1 if it does not divide b) and by writing the repunit in question as (b^(p−1)−1)/(b−1) where b is the base. The question I am asking is much harder; it is probably “more or less” equivalent to asking whether there are an infinite number of primes p such that p does *not* divide any repunit of length shorter than p−1. Concerning your other question, the answer is “yes”: the period is always in one of the forms that you indicate (and which it is depends on whether 10 is quadratric residue or nonresidue modulo the prime).

## Karl P (2004-12-10T13:45:08Z)

Thinking of the (k)th and (k+1)st decimal, I suspect that the p+1 digit period, taken as an integer, is of the form of either

n*10^k - n

or

n*10^k + n

for some integer n with k or fewer (if p>10) digits and n ends in 1,3,7 or 9.
For p=7, n=143 and 142857=143000-143.
Is this true?

## Karl P (2004-12-10T12:59:38Z)

Is the last question equivalent to saying
are there an infinite number of prime numbers p such that p is a divisor of the p-1 digit repunit (all digits = 1), in a given base?

For example, p=7 in decimal has 111111 = 3*7*11*13*37.

Name or nick (mandatory):
Web site URL (optional):
Email address (optional, will not appear):
Identifier phrase (optional, see below):
Attempt to remember the values above?
The comment itself (mandatory):

Optional message for moderator (hidden to others):

Spam protection: please enter below the following signs in reverse order: `02fb55`

• Comments will not appear until they have been reviewed by the moderator.
• Deleting comments is not supported. Please think before you post.
• HTML is not allowed in content or elsewhere (writing `<foo>` simply produces <foo> in the text).
• To cite a URL, write `<URL: http://somewhere.tld/ >`, and it will be automatically made into a link. (Do not try any other way or it might count as an attempt to spam.)
• Your email address will not appear to other readers. Use it if you wish to leave me (the moderator) a way of contacting you.
• To leave a contact address for all readers, use the Web site address field (it can be a `mailto:` URI, e.g. `mailto:my.email@somewhere.tld`, if you do not have a genuine Web site).
• You can use an optional (semi-secret) “identifier phrase” of your choice to avoid identity stealing: it will not appear except to the moderator, who can use it to detect obvious usurpations. Don't rely seriously on this, however.
• Use the last field to enter any other kind of comments for the moderator's eyes only.