TITLE: $\sum\limits_{k=0}^{\frac{p-1}2}3^k\binom{p}{k}\equiv 2^p-1\pmod{p^2}$
QUESTION [6 upvotes]: Let $p$ be prime and $p\ge5$. My friend askes me the following
$\sum\limits_{k=0}^{\frac{p-1}2}3^k\binom{p}{k}\equiv 2^p-1\pmod{p^2}$.
Here $\binom{p}{k}=\frac{p!}{k!(p-k)!}$ for any $k=0,\ldots,p$. We define $0!=1$. 
I think this is true, but I have no idea to attempt it.

REPLY [3 votes]: The whole credit of this answer goes to math154 on AoPS.

Given that $1\leq k\leq\frac{p-1}{2}$ we have
$$ \binom{p}{k}=\frac{p}{k}\binom{p-1}{k-1}\stackrel{\text{Lucas}}{\equiv}\frac{p}{k}(-1)^{k-1}\equiv 2(-1)^k\frac{p}{2k}(-1)^{2k-1}\equiv 2(-1)^k\binom{p}{2k}\pmod{p^2} $$
so the problem boils down to evaluating
$$ \sum_{k=0}^{\frac{p-1}{2}}2\binom{p}{2k}(-3)^k\stackrel{\text{DFT}}{=}(1+\sqrt{-3})^p+(1-\sqrt{-3})^p \equiv 2^p\pmod{p^2} $$
where the last equality follows from the fact that if $\omega$ is a primitive third root of unity, $1+\omega^m+\omega^{2m}=0$ for any $m\in\mathbb{Z}\setminus 3\mathbb{Z}$.