Find all n for which $2^n + 3^n$ is divisible by $7$? I am trying to do this with mods.  I know that:
$2^{3k+1} \equiv 1 \pmod 7$, $2^{3k+2} \equiv 4 \pmod 7$, $2^{3k} \equiv 6 \pmod 7$ and $3^{3k+1} \equiv 3 \pmod 7$, $3^{3k+2} \equiv 2 \pmod 7$,  $3^{3k} \equiv 6 \pmod 7$, so I thought that the answer would be when $n$ is a multiple of $3$ since then $2^{3k} + 3^{3k} \equiv 1 + 6 \pmod 7$, but it doesn't work for $n = 6$
 A: Note that $3^6\equiv 1$, not $6$. You actually need to do this with exponents $6k, 6k+1, 6k+2$ and so on. Fermat's little theorem says that that's enough.
A: Powers of $2$ modulo $7$ are $1,2,4,1,2,4,\cdots$ repeating every $3$ and powers of $3$ modulo $7$ are $1,3,2,6,4,5,1,\cdots$ repeating every $6$ 
Adding these sequence gives $n \equiv 3 \pmod{6}$ so $7$ divides $2^n+3^n$ if and only if $n=3+6m$ (for $ m \in \mathbb{N}_0$).
A: $2^{3}\equiv 8\equiv \color{red}1 \bmod 7$, which is why you get a cycle length of  $3$ for powers of $2 \bmod 7$. The cycle only closes when you reach $a^k\equiv 1$.
However $3^3=27\equiv 6 \bmod 7$ means that the exponential cycle length for $3\bmod 7$ is more than $3$. Fermat's little theorem says that every cycle length$\bmod 7$ (of numbers coprime to $7$) must divide $6$, so the cycle length for $3$ must be $6$.  (and indeed $3^6 \equiv (3^3)^2\equiv 6^2 \equiv 36 \equiv 1 \bmod 7$).
A: Since $(x-2)(x-3)=x^2-5x+6$, we get that
$$
a_n=5a_{n-1}-6a_{n-2}
$$
is satisfied by $a_n=2^n+3^n$. Since $a_0\equiv2\pmod7$ and $a_1\equiv5\pmod7$, we get the following sequence mod $7$:
$$
\color{#C00}{2},\color{#C00}{5},6,\color{#090}{0},6,2,\color{#C00}{2},\color{#C00}{5},
$$
Thus, the sequence mod $7$ has period $6$. Therefore,
$$
n\equiv3\pmod6\iff2^n+3^n\equiv0\pmod7
$$
A: We need $$2^n+3^n\equiv0\pmod7\iff3^n\equiv-2^n\iff-1\equiv(3\cdot4)^n\equiv(-2)^n$$ using $2\cdot4\equiv1\pmod7\iff2^{-1}\equiv4$
$\implies(-2)^n\equiv-1\equiv(-2)^3\iff(-2)^{n-3}\equiv1$
$\implies n-3\equiv0\pmod6$ as $(-2)^3\equiv-1,(-2)^6\equiv1$
