5
$\begingroup$

Find all $n$ such that $n \mid 3^n + 1$.

I know we want to show that $3^n \equiv -1$ (mod $n$). I have tried using the fact that $3^{\phi(n)} \equiv 1$ (mod $n$), but I am not sure how to proceed.

  • 3
    OEIS sequence [A015949](https://oeis.org/A015949). I don't know if there is a simple characterization.2017-01-10
  • 3
    Is the problem your own creation, or does it have some other source?2017-01-10
  • 3
    Possible duplicate of [When does $n$ divide $2^n+1$?](http://math.stackexchange.com/questions/2122615/when-does-n-divide-2n1)2017-02-01
  • 0
    Sorry, suggesting the above as a duplicate was a mistake on my side (I have already retracted my duplicate vote.) I found some questions with additional requirement that $n$ is odd, but I did not find an exact duplicate. For odd $n$ you have, for example, [Find all odd $n \in \mathbb{Z}^+$ such that $n\mid 3^n+1$.](http://math.stackexchange.com/q/1805712)2017-02-02

1 Answers 1

1

$n$ divides $3^n + 1$ if and only if $3^n \mod n$ yields $-1$ or equivalently $n-1$ as residue

$$n | (3^n + 1) \iff 3^n \equiv -1 \equiv n-1 \pmod n$$

Then the divisibility is proved as following: $$3^n + 1 \equiv n-1 + 1 \equiv -1 + 1 \equiv 0 \pmod n$$

Note that the following method doesn't generate the whole sequence as seen in OEIS, but let $n=2\cdot5^m$ then:

$$3^{2\cdot 5^{m-1}} \equiv -1 \pmod{n}$$

The exponent of $3$ is obtained by evaluating factors of $n \mod \varphi(n)$:

$$5^m \equiv 5^{m-1} \pmod{\varphi(n)}$$

Some examples are: $\{10,50,250,1250,6250,31250,...\}$

  • 0
    I believe the "if" in the first sentence could be converted to "if and only if."2017-01-11
  • 1
    Yeah I notice now that I used iff in the math expression but not in the text. Thanks.2017-01-11