Related to [this question](https://mathoverflow.net/questions/283758/conjecture-the-number-of-points-modulo-p-of-certain-elliptic-curve-is-p-or).


Let $E / \mathbb{F}\_p : y^2=x^3+2$.


Numerical evidence up to $2 \cdot 10^5$ suggests:


Conjecture: $\#E(\mathbb{F}\_p) \in \{p,p+2\}$ iff $p$ is of the form
$27a^2+27a+7$ for positive integer $a$.


Is the conjecture true?


`GH from MO` proved that if $p$ is of the given form the
order is $p$ or $p+2$.


The sequence of primes is [OEIS A275878 Standard Jacobi primes](https://oeis.org/A275878).



$\#E(\mathbb{F}_p) \in \{p,p+2\}$ iff $p$ is of the form $27a^2+27a+7$
This conjecture is also true. Let $p$ be a prime, and let me follow my proof of the [previous conjecture](https://mathoverflow.net/questions/283758/conjecture-the-number-of-points-modulo-p-of-certain-elliptic-curve-is-p-or).


If $p\not\equiv 1\pmod{3}$, then the map $x\mapsto x^3$ permutes the residues modulo $p$, hence in this case the *affine* elliptic curve $E$ modulo $p$ has $p$ points (i.e. the projective version has $p+1$ points).


If $p\equiv 1\pmod{3}$, then by the analysis of my proof, we need to prove:
$$ J(\chi,\chi)+J(\overline{\chi},\overline{\chi})=\pm 1\qquad\Longleftrightarrow\qquad\text{$p=27a^2+27a+7$ for some $a\in\mathbb{N}$}.$$
We can write $4p$ uniquely as $u^2+27v^2$ with $u\equiv 1\pmod{3}$ and $v$ positive, and by Lemma 2.6 in Chapter 6 of Rose: A course in number theory (2nd ed., Oxford University Press, 1994), we can identify $u$ as $J(\chi,\chi)+J(\overline{\chi},\overline{\chi})$. Therefore,
$$ J(\chi,\chi)+J(\overline{\chi},\overline{\chi})=\pm 1\qquad\Longleftrightarrow\qquad\text{$4p=1+27v^2$ for some $v\in\mathbb{N}$}.$$
The result is now immediate, because clearly
\begin{align\*}\text{$4p=1+27v^2$ for some $v\in\mathbb{N}$}&\qquad\Longleftrightarrow\qquad\text{$4p=1+27(2a+1)^2$ for some $a\in\mathbb{N}$}\\
&\qquad\Longleftrightarrow\qquad\text{$p=27a^2+27a+7$ for some $a\in\mathbb{N}$}.
\end{align\*}


The proof is complete.


