Number of points of elliptic curve over $\mathbb{F}_p$ with CM by $\sqrt{-2}$ when $p\equiv 1\bmod 8$ I was trying to calculate the number of points of the curve $E:y^2 = x^3 + 4x^2 + 2x$ over $\mathbb{F}_p$ for $p\equiv 1\bmod 8$ (In order to have $\sqrt{-2}\in\mathbb{F}_p$) but I did not succeed. This curve is mentioned in Silverman's Advanced Topics in the Arithmetic of Elliptic curves (Proposition 2.3.1) to have multiplication by $\sqrt{-2}$. 
Over these primes $p\equiv 1\bmod 8$ the curve $E$ has full $2$-torsion so $E(\mathbb{F}_p)\cong \mathbb{Z}/(2)\times \mathbb{Z}/(k)$. 
In this case my conjecture is that the size will be related to the factorization of $p=(a+b\sqrt{-2})(a-b\sqrt{-2})$ over $\mathbb{Z}[i\sqrt{2}]$, that is $p=a^2 + 2b^2$. Hence, $\#E(\mathbb{F}_p)=p+1\pm 2a$ where $a$ is odd (and the sign I do not know how to choose it yet). Calculating this reminds me to the proof of the Last Entry of Gauss Tagebuch.
I would like to have an elliptic curve with CM by $\sqrt{-2}$ such that I can know the number of points in terms of $p$. Does anybody has a suggestion? or maybe another curve?
Thanks
 A: Sorry for self-advertisement: the question of the "sign" that one must choose
(equivalently which $\pi$ or $\overline{\pi}$) is entirely answered in my
book GTM239, Section 8.5.2, some of the results being due to Mark Watkins
(unpublished I believe). The main idea is to show that any CM curve is
equivalent in an evident sense to a "basic" CM elliptic curve with a
specific equation, giving a relation between the number of points of
the initial curve and the "basic" curve, and then Theorem 8.5.8 determines
explicitly the number of points of that basic curve. I did not do the exercise
for your specific example, but it is completely algorithmic.
A: Your conjecture is true and follows from a theorem in Cox's book ''Primes of the form $x^{2} + ny^{2}$.'' (Theorem 14.16 on page 317, although this is from the first edition.) In particular, if $\mathcal{O}$ is an order in an imaginary quadratic field, $L$ is the ring class field associated to $\mathcal{O}$ and $E/L$ is an elliptic curve, with good reduction at a degree one prime $\mathfrak{P}$ of $L$, then $\mathcal{O}/\mathfrak{P} \cong \mathbb{F}_{p}$ and
$$
  |E(\mathbb{F}_{p})| = p+1 - (\pi + \overline{\pi})
$$
where $\pi \in \mathcal{O}$ and $p = \pi \overline{\pi}$. [ This result was originally proven by Deuring, and in fact Deuring's result is more general. ]
Your conjecture follows by taking $\mathcal{O} = \mathbb{Z}[\sqrt{-2}]$, $L = \mathbb{Q}(\sqrt{-2})$ and $p$ to be a prime $\equiv 1 \text{ or 3 } \pmod{8}$ (which implies that $\sqrt{-2} \in \mathbb{F}_{p}$). In this case, your $\pi = a + b \sqrt{-2}$. This theorem doesn't answer the question of what the sign is in the equation $|E(\mathbb{F}_{p})| = p+1 \pm 2a$. 
