# How can prove this $\sum_{k=0}^{p}\binom{p}{k}(\pm i\sqrt{3})^k\equiv 1\pm (i\sqrt{3})^p-p\sum_{k=1}^{p-1}\frac{(\mp i\sqrt{3})^k}{k}\pmod{p^2}?$

For any prime $p>3$ show that $$p\sum_{j=0}^{p-1}\dfrac{(-3)^j}{2j+1}\equiv \left(\dfrac{p}{3}\right)\pmod{p^2}$$ where $\left(\dfrac{p}{3}\right)$ denotes the Legendre symbol.

This is proof: we have $$(1\pm i\sqrt{3})^p=2^pe^{\pm i\pi p/3}=2^p(\cos{(\pi p/3)}\pm i\sin{(\pi p/3)}=2^{p-1}\left(1\pm i\left(\dfrac{p}{3}\right)\sqrt{3}\right)$$ On the other hand we have \begin{align*} (1\pm i\sqrt{3})^p=\sum_{k=0}^{p}\binom{p}{k}(\pm i\sqrt{3})^k&\equiv 1\pm (i\sqrt{3})^p-p\sum_{k=1}^{p-1}\dfrac{(\mp i\sqrt{3})^k}{k}\\ &\equiv 1\pm i\sqrt{3}(-3)^{(p-1)/2}-S_{0}\pm i\sqrt{3}S_{1}\pmod{p^2} \end{align*} where $$S_{0}=p\sum_{j=1}^{\frac{p-1}{2}}\dfrac{(-3)^j}{2j},S_{1}=p\sum_{j=0}^{\frac{p-3}{2}}\dfrac{(-3)^j}{2j+1}$$ then $$S_{0}\equiv 1-2^{p-1}\pmod{p^2}, S_{1}\equiv 2^{p-1}\left(\dfrac{p}{3}\right)-(-3)^{(p-1)/2}\pmod{p^2}$$ so \begin{align*} p\sum_{j=0}^{p-1}\dfrac{(-3)^j}{2j+1}&=p\sum_{j=0}^{(p-3)/2}\dfrac{(-3)^j}{2j+1}+(-3)^{(p-1)/2}+(-3)^{(p-1)/2}p\sum_{j=1}^{(p-1)/2}\dfrac{(-3)^j}{p+2j}\\ &\equiv S_{1}+(-3)^{(p-1)/2}+(-3)^{(p-1)/2}S_{0}\\ &\equiv (2^{p-1}-1)\left(\left(\dfrac{p}{3}\right)-(-3)^{(p-1)/2}\right)+\left(\dfrac{p}{3}\right)\\ &\equiv \left(\dfrac{p}{3}\right)\pmod{p^2} \end{align*} where use $$p|(2^{p-1}-1),2|\left(\left(\dfrac{p}{3}\right)-(-3)^{(p-1)/2}\right)$$

My question:

(1)：why $$\sum_{k=0}^{p}\binom{p}{k}(\pm i\sqrt{3})^k\equiv 1\pm (i\sqrt{3})^p-p\sum_{k=1}^{p-1}\dfrac{(\mp i\sqrt{3})^k}{k}\pmod{p^2}?$$ (2): why $$S_{0}\equiv 1-2^{p-1}\pmod{p^2}, S_{1}\equiv 2^{p-1}\left(\dfrac{p}{3}\right)-(-3)^{(p-1)/2}\pmod{p^2}?$$

Thank you someone can solve my two problem,Thank you very much,and this $$p\sum_{j=0}^{p-1}\dfrac{(-3)^j}{2j+1}\equiv \left(\dfrac{p}{3}\right)\pmod{p^2}$$ have other methods? Thank you

-

Now,I have konw why $$S_{0}\equiv 1-2^{p-1}\pmod {p^2},S_{1}\equiv 2^{p-1}\left(\frac{p}{3}\right)-(-3)^{(p-1)/2}\pmod {p^2}$$
Because use $$(1\pm i\sqrt{3})^p=2^{p-1}(1\pm i\left(\frac{p}{3}\right)\sqrt{3})$$ and other hand we have $$(1\pm i\sqrt{3})^p\equiv 1\pm i\sqrt{3}(-3)^{(p-1)/2}-S_{0}\pm i\sqrt{3}S_{1}\pmod{p^2}$$ so we have done