Can $7$ be the smallest prime factor of a repunit?
Can $7$ be the smallest prime factor of a repunit?
No, it cannot.
The main idea is as follows: If the $n^\text{th}$ repunit $R(n)$ is divisible by $7$, then $n$ is divisible by $6$, which means $n$ is divisible by $3$, which means $R(n)$ is divisible by $3$, so $7$ cannot be the smallest prime factor.
The full argument is fleshed out below.
Let $R(n)$ be the $n^\text{th}$ repunit, e.g. $R(4) = 1111$.
One interesting property about repunits is that if an integer $m$ divides $R(n)$, then $m$ divides $R(2n)$, and $m$ divides $R(3n)$, and so on. This is because, for any positive integer $n$, we have the factorization $$R(2n) = \left(10^{n}+1\right)R(n)$$ and, more generally, for any positive integers $k$ and $n$, we can factor as follows:
$$R(kn) = \left(\displaystyle\sum\limits_{j=0}^{k-1} 10^{jn}\right)R(n)$$
What this means, for your problem, is if a prime $p$ divides a repunit $R(n)$, then it will also divide $R(kn)$ for all $k$.
This tells us that:
Every other repunit is divisible by $11$. $$11 \,|\, R(2) \implies\,\Big(\,\,\,n \equiv 0 \pmod{2} \iff 11 \,|\, R(n) \,\,\,\Big)$$ Here, the "$\iff$" bidirectionality follows from the fact that $11 \not| \,\,R(1)$.
Every third repunit is divisible by $3$. $$3 \,|\, R(3) \implies \,\Big(\,\,\,n \equiv 0 \pmod{3} \iff 3 \, |\, R(n) \,\,\,\Big)$$ Here, the "$\iff$" bidirectionality follows from the fact that $3 \not| \,\,R(1)$ and $3 \not| \,\,R(2)$.
Every third repunit is divisible by $37$. $$37 \,|\, R(3) \implies \,\Big(\,\,\,n \equiv 0 \pmod{3} \iff 37 \, |\, R(n) \,\,\,\Big)$$ Here, the "$\iff$" bidirectionality follows from the fact that $37 \not| \,\,R(1)$ and $37 \not| \,\,R(2)$.
Every sixth repunit is divisible by $13$.$$13 \,|\, R(6) \implies \,\Big(\,\,\,n \equiv 0 \pmod{6} \iff 13 \, |\, R(n) \,\,\,\Big)$$ Here, the fact that each of $1, 11, 111, 1111, 11111$ are not divisible by $13$ implies the "$\iff$" bidirectionality.
Every sixth repunit is divisible by $7$.$$7 \,|\, R(6) \implies \,\Big(\,\,\,n \equiv 0 \pmod{6} \iff 7 \, |\, R(n) \,\,\,\Big)$$ Here, the fact that each of $1, 11, 111, 1111, 11111$ are not divisible by $7$ implies the "$\iff$" bidirectionality.
This last fact implies that $7$ can never be the smallest prime factor of a repunit, because whenever $n \equiv 0 \pmod{6}$, it's also true that $n \equiv 0 \pmod{3}$, so whenever $7$ is a factor of a repunit, $3$ will be as well.
By a similar argument, $13$ and $37$ also cannot be the smallest prime factor of a repunit.
The repunits as a recurrence obey $$ r_{n+1} = 10 r_n + 1 $$ see https://en.wikipedia.org/wiki/Pisano_period
The code making the table of Pisano periods below. The simple outcome: the possible values of $r_n \pmod{21}$ are $$ 0, 1, 2, 6, 11, 19 . $$ In particular, the remainder after dividing by 21 can be $6,$ but is never $7$ or $14 \pmod {21}.$ Thus, $r_n$ can be divisible by $3$ alone, without any $7.$ Once $r_n$ is divisible by $7,$ the only possibility is $0 \pmod {21},$ meaning also divisible by $3$
mpz_class rep = 0;
for(int n = 1; n <= 45; ++n){
rep = rep * 10 + 1;
cout << " n: " << n << " rep: " << rep << " mod 21: " << rep % 21 << endl;
}
with no extra symbols. This is also a complete proof:
jagy@phobeusjunior:~$ ./mse
Wed Nov 27 18:45:37 PST 2019
n: 1 rep: 1 mod 21: 1
n: 2 rep: 11 mod 21: 11
n: 3 rep: 111 mod 21: 6
n: 4 rep: 1111 mod 21: 19
n: 5 rep: 11111 mod 21: 2
n: 6 rep: 111111 mod 21: 0
n: 7 rep: 1111111 mod 21: 1
n: 8 rep: 11111111 mod 21: 11
n: 9 rep: 111111111 mod 21: 6
n: 10 rep: 1111111111 mod 21: 19
n: 11 rep: 11111111111 mod 21: 2
n: 12 rep: 111111111111 mod 21: 0
n: 13 rep: 1111111111111 mod 21: 1
n: 14 rep: 11111111111111 mod 21: 11
n: 15 rep: 111111111111111 mod 21: 6
n: 16 rep: 1111111111111111 mod 21: 19
n: 17 rep: 11111111111111111 mod 21: 2
n: 18 rep: 111111111111111111 mod 21: 0
n: 19 rep: 1111111111111111111 mod 21: 1
n: 20 rep: 11111111111111111111 mod 21: 11
n: 21 rep: 111111111111111111111 mod 21: 6
n: 22 rep: 1111111111111111111111 mod 21: 19
n: 23 rep: 11111111111111111111111 mod 21: 2
n: 24 rep: 111111111111111111111111 mod 21: 0
n: 25 rep: 1111111111111111111111111 mod 21: 1
n: 26 rep: 11111111111111111111111111 mod 21: 11
n: 27 rep: 111111111111111111111111111 mod 21: 6
n: 28 rep: 1111111111111111111111111111 mod 21: 19
n: 29 rep: 11111111111111111111111111111 mod 21: 2
n: 30 rep: 111111111111111111111111111111 mod 21: 0
n: 31 rep: 1111111111111111111111111111111 mod 21: 1
n: 32 rep: 11111111111111111111111111111111 mod 21: 11
n: 33 rep: 111111111111111111111111111111111 mod 21: 6
n: 34 rep: 1111111111111111111111111111111111 mod 21: 19
n: 35 rep: 11111111111111111111111111111111111 mod 21: 2
n: 36 rep: 111111111111111111111111111111111111 mod 21: 0
n: 37 rep: 1111111111111111111111111111111111111 mod 21: 1
n: 38 rep: 11111111111111111111111111111111111111 mod 21: 11
n: 39 rep: 111111111111111111111111111111111111111 mod 21: 6
n: 40 rep: 1111111111111111111111111111111111111111 mod 21: 19
n: 41 rep: 11111111111111111111111111111111111111111 mod 21: 2
n: 42 rep: 111111111111111111111111111111111111111111 mod 21: 0
n: 43 rep: 1111111111111111111111111111111111111111111 mod 21: 1
n: 44 rep: 11111111111111111111111111111111111111111111 mod 21: 11
n: 45 rep: 111111111111111111111111111111111111111111111 mod 21: 6
Wed Nov 27 18:45:37 PST 2019
jagy@phobeusjunior:~$