TITLE: Primes of the form $x^2+5xy+5y^2$
QUESTION [6 upvotes]: Trying to describe all primes of the form:
$$x^2+5xy+5y^2$$
A hint was given with the question to show all primes $p$ for which 5 is a quadratic residue mod $p$. I've been able to show that all primes $\pm1$ mod 5 satisfy this... but I don't know how this helps. Any next-step pointers would be appreciated! Thanks!

REPLY [5 votes]: Um, look, any (positive) odd prime with $(5|p) = (p | 5) = 1$ can be used to produce a binary quadratic form $f(x,y) = a x^2 + b x y + c y^2,$ or $\langle a,b,c \rangle,$ with particular coefficients $\langle p,\beta,\gamma \rangle$ with discriminant $\Delta = \beta^2 - 4 p \gamma = 5.$ This can then be reduced to $\langle 1,1,-1 \rangle$ or the equivalent  $\langle -1,1,1 \rangle,$ showing that we can write $p = u^2 + u v - v^2.$ A small change shows $p = x^2 + 5 x y + 5 y^2,$ maybe you can do that part. 
See Numbers representable as $x^2 + 2y^2$ 
Note that reduction for indefinite forms is a little different from positive. We can arrange $\langle a,b,c \rangle,$ such that $0 < b < \sqrt \Delta$ and
$ \sqrt \Delta - b < 2 |a| < \sqrt \Delta + b$ and there are more than one,  a finite number of reduced forms in each equivalence class. 
Reduction can be arranged by a finite sequence of these steps:  take the "Hessian" matrix of the  form $\langle a,b,c \rangle,$ as
$$
H = \left(  \begin{array}{cc}
  2a  &  b  \\
  b  &  2c  
\end{array} 
  \right).
$$ 
Now take the matrix $P \in SL_2 \mathbb Z$ given by
$$
P = \left(  \begin{array}{cc}
  0  &  -1  \\
  1  &  \delta  
\end{array} 
  \right)
$$
and calculate
$$ G = P^T H P.    $$
Now, $G$ is the Hessian matrix of an "equivalent" form (think about how to go back from a Hessian matrix to a form). A correct choice of the integer $\delta$ takes the form closer to reduced, after a few such steps the form is reduced, and further steps take the form through a cycle of equivalent forms, back to the first reduced one. The absolute values of the $\delta$'s (once reduced) are the digits for the repeated part of the continued fraction for a certain quadratic irrational, tied up with Pell's equation.  The continued fraction with all "digits" equal to $1$ is the Golden Ratio. I'm just sayin'.
================
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle
Input three coefficients a b c for indef f(x,y)= a x^2 + b x y + c y^2 
   1       5      5  

  0  form              1           5           5  delta      0
  1  form              5          -5           1  delta     -2
  2  form              1           1          -1


          -1           2
           0          -1

To Return  
          -1          -2
           0          -1

0  form   1 1 -1   delta  -1
1  form   -1 1 1   delta  1
2  form   1 1 -1
minimum was   1rep 1 0 disc   5 dSqrt 2.2360679775  M_Ratio  5
Automorph, written on right of Gram matrix:  
-1  -1
-1  -2
 Trace:  -3   gcd(a21, a22 - a11, a12) : 1
=========================================
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ 

==================