<s>[INST] Solving $(a-1)^{p+1}+a^p=(a+1)^{p-1}$ 
Suppose that $a,p$ are nonnegative integers such that $p$ is prime and $p\nmid (a-1)$. If $(a-1)^{p+1}+a^p=(a+1)^{p-1}$, find the sum of all possible values of $a$.

We can't have $p = 2$ since the equation $$(a-1)^3+a^2 = (a+1)$$ has no integer solutions. We now take two cases:
Case 1: $p \mid (a+1)$
In this case, $a \equiv -1 \pmod{p}$. Then $(a-1)^{p+1} \equiv (-2)^{p+1} \equiv 4 \equiv -a^p \equiv -a \pmod{p}$. Thus $a \equiv 4 \pmod{p}$ and therefore $p \mid 3$, so that $p = 3$. Thus $a = 2$ in this case.
Case 2: $p \nmid (a+1)$
We have $$(a-1)^{p+1}+a^p \equiv (a-1)^2+a^p \equiv 1 \pmod{p}.$$ If $a \not \equiv 0 \pmod{p}$, then we have $(a-1)^2+a \equiv 1 \pmod{p}$, which gives $a(a-1) \equiv 0 \pmod{p}$. Thus $p \mid (a-1)$, a contradiction. Thus $a \equiv 0 \pmod{p}$.  
How do I continue from here?
 [/INST] I will assume $p$ is odd.
Consider the monic polynomial $f(X) = (X-1)^{p+1} + X^p - (X+1)^{p-1}$.
It has $0$ as a root, so dividing by $X$ we find $g(X) = f(X)/X$ is another monic polynomial.
The constant term of $g$ is ${p+1 \choose p}(-1)^p-{p-1 \choose p-2} = (p+1)(-1)^p-(p-1) = -2p$.
The rational root theorem gives us the possible integer roots of $f$ as $0, \pm 1, \pm 2, \pm p, \pm 2p.$
We should be able to test each of these candidates and thus find all integer roots, and their sum.
Since we are interested only in positive integers (and $0$ would not affect the sum) we only need to check $1, 2, p, 2p$.
$a = 1$ is impossible because $f(1) = 1 - 2^{p-1} = 0$ requires $p = 1$ which is not prime.
$a = 2$ gives the equation $2^p + 1 = 3^{p-1}$ which is true only when $p = 3$.
$a = p$ leads to $f(p) = (p-1)^{p+1} + p^p - (p+1)^{p-1}=0$.
But $f(p) \geq (p-1)^{p-1}\left((p-1)^2+(p-1)-\left(1+\frac{2}{p-1}\right)^{p-1}\right)\geq 4^4(4^2+4-e^2) \gt 0$ for $p \geq 5.$ We can check $p = 3$ individually to find $f(3) = 27 \gt 0$ so $p$ is not a root.
[A much simpler way occurred to me, since $p$ is odd this is impossible because $(p-1)^{p+1} + p^p - (p+1)^{p-1}$ is odd too].
$a = 2p$ should work similarly as well.
</s>