$\large{7 \mid 5^n +1}$

Find the number of positive integers $n \leq 1000$ that satisfy the condition above.

The answer is 167.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

We note that $7 \mid 5^n + 1 \implies 5^n \equiv -1 \text{ (mod 7)}$ . Consider $5^n \equiv (7-2)^n \equiv (-2)^n \text{ (mod 7)}$ . For the first few $n$ , we have $(-2)^n = -2, 4, -1, 2, -4, 1, -2, ....$ We note that $(-2)^n$ has a period of 6 and $(-2)^n = -1$ , when $n \bmod 6 = 3$ . For $n \le 1000$ , the acceptable $n=3,9,15,... 999$ , a total of $\boxed{167}$ of them.