OFFSET
1,1
COMMENTS
If p is an odd prime different from 5, then p divides an infinite number of terms of the sequence of repunits {1, 11, 111, 1111, ... }. The proof is elementary: let p be such a prime. If p = 3, then 3 divides (10^3-1)/9 = 111. Otherwise, take k = (10^p - 1)/9; by the Fermat theorem, 10^(p-1) == 1 (mod p), so p divides (10^(p-1)-1); since p is relatively prime to 9, it divides k. Trivially, if p divides any k digit repunit, it divides the k*m digit repunit as well.
REFERENCES
David Wells, The Factors of the Repunits 11 through R_40, The Penguin Dictionary of Curious and Interesting Numbers, p. 219 Penguin 1986.
David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, 1997.
David Wells, Curious and Interesting Numbers (Revised), Penguin Books, page 114.
LINKS
Project Euler, Problem 129: Repunit divisibility
S. S. Wagstaff, Jr., The Cunningham Project
Eric Weisstein's World of Mathematics, Repunit.
EXAMPLE
3 divides 111, but not 1 or 11, so a(1) = 3.
7 divides 111111 but not 1, 11, 111, 1111, or 11111, so a(2) = 6.
PROG
(PARI) a(n) = {k=1; p = if(n>1, prime(n+2), 3); while((10^k-1)/9 % p, k++); k; } \\ Michel Marcus, May 25 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 01 2010
EXTENSIONS
Corrected and edited by Michel Lagneau, Apr 25 2010
Term 6 between terms 44 and 96 doesn't belong to the sequence. The same for term 43 between terms 43 and 178. Corrected and edited by Krzysztof Wojtas, May 25 2014
STATUS
approved