Divisibility of sum of powers: $\ 323\mid 20^n+16^n-3^n-1\ $ for which $n?$ I found this question in my Math Challenge II Number Theory packet: Find all positive integers $n$ that satisfy $323|20^n+16^n-3^n-1$. I don't even have any idea how to approach this question. Any suggestions?
 A: $323 = 17\cdot 19$. So $323$ divides $20^n+16^n-3^n-1$ if and only if both its prime factors, $17$ and $19$, divide it. We have
$$20^n + 16^n - 3^n - 1 \equiv 3^n + (-1)^n - 3^n - 1 \pmod{17}$$
and
$$20^n + 16^n - 3^n - 1 \equiv 1^n + (-3)^n - 3^n - 1 \pmod{19}.$$
From that, it is easy to find the desired $n$.
A: Slightly more effort yields a more general result. With $\,o_n(x) :=$ order of $\,x\pmod{\! n}$ 
Theorem $\ $ If $\,\ m\mid a\!-\!c,\,\ \overline m \mid a\!-\!d\ $ and  $\ m,\overline m,b\,$ are pairwise-coprime then 
$\qquad\qquad\quad  m\overline m\mid e = a^n\!+b^n\!-c^n\!-d^n\!\iff {\rm lcm}(o_m(d/b),o_{\overline m}(c/b))\mid n,$
Proof $\:\! $ note  $\,(m,\overline m)= 1\,\Rightarrow\,{\rm lcm}(m,\overline m) =  m\overline m,\ $ so $\  m\overline m\mid e\iff  m,\overline m\mid e$
$\ \ \ \ \ \ \begin{align}{\rm mod}\ m\!:\ a\equiv c\ \ &{\rm so}\ \ e\equiv b^n\!-d^n\!\equiv 0\! \overset{(b,m)=1}\iff\! (d/b)^n\equiv 1\!\iff o_m(d/b)\mid n\\[.1em]
{\rm mod}\ \overline m\!:\ a\equiv d\ \ &{\rm so}\ \ e\equiv b^n\!-c^n\equiv 0 \!\overset{(b,\overline m)=1}\iff\! (c/b)^n\equiv 1\iff o_{\overline m}(c/b)\mid n \end{align}$
So $\,m,\overline m\mid e\!\iff\! o_m(d/b)\mid n,\ o_{\overline m}(c/b)\mid n\!\iff\! {\rm lcm}(o_m(d/b),o_{\overline m}(c/b))\mid n$

You have $\ \overset{\Large 17\ \mid\ 20-3}{m\mid a\!-\!c},\, $ and $\  \ \overset{\Large 19\ \mid\ 20-1 }{\overline m\mid a\!-\!d }$ and $\overset{\Large 17,\,19,\,16}{\,m,\,\overline m,\,b}\ $ are paiwise coprime, and
$\ \ \ \ \ \ \ \begin{align}{\rm mod}\ m=17\!:\,\ &d/b = 1/16\equiv 1/{-}1\equiv  -1\rm\ \ has\  order\ \ \color{#c00}2\\[.3em]
{\rm mod}\ \overline m=19\!:\,\ &\:\!c/b = 3/16\equiv 3/{-}3\equiv -1\rm\ \ has\ order \ \ \color{#0a0}2\end{align}$
$\begin{eqnarray}\text{By the Theorem}\ \ \,  m\,\overline m\,&\mid&\ \  a^n\, &+&\ \ b^n&-&c^n&-&d^n&\!\!\!\iff& {\rm lcm}(o_m(d/b),o_{\overline m}(c/b))\mid n\\[.2em] 
{\rm i.e.}\ \ \ 323= 17\cdot 19\,&\mid&  20^n&+&16^n&-&3^n&-&1^n&\!\!\!\iff& {\rm lcm}(\color{#c00}2,\color{#0a0}2)=2\mid n
\end{eqnarray}$
