Does $p = x^2 + 9y^2$ for some $x$, $y \in \mathbb{Z}$ if and only if $p \equiv 1 \text{ mod }12$? For a prime number $p \neq 2$, $3$, does $p = x^2 + 9y^2$ for some $x$, $y \in \mathbb{Z}$ if and only if $p \equiv 1 \text{ mod }12$?
A case where this is true as to suggest plausibility: $13 = 2^2 + 9 \times 1^2$.
 A: A start:
A famous theorem proven by Fermat says $p = x^2 + y^2$ if and only if $p \equiv 1 \bmod 4$. Also, $x^2 \pmod 3$ only takes on the values of $0$ or $1$.
Now we have $p = x^2 + 9y^2 = x^2 + (3y)^2$.
The finish (credit to Mikhail Ivanov):
$\Rightarrow$: Let $p = 12k+1$. We know $p = x^2 + y^2$. If neither $x, y$ are divisible by $3$, then $p \equiv x^2 + y^2 \equiv 2 \mod 3$, contradiction. Hence, one of $x$ or $y$ is divisible by $3$, WLOG let $x = 3z$. Then we have $p = 9z^2 + y^2$, which is what we wanted to prove.
$\Leftarrow$: We have $x^2 + 9y^2 \equiv x^2 \equiv 0$ or $1 \mod 3$ and $x^2 + 9y^2 \equiv 0, 1$ or $2 \mod 4$.
The possibilities $\mod 12$ are then $0, 1, 4, 6, 9, 10$. Only $1$ is possible to be prime, thus $x^2 + 9y^2 \equiv 1 \mod 12$ if it is prime.
A: Finish: 
For $p=12k+1$, we have $p=x^2+y^2$, and,  if $gcd(xy, 3)=1$, then $p\equiv x^2+y^2\equiv 2 \pmod 3 $, a contradiction.
Conversely, $x^2+9y^2\equiv 0$ or $1 \pmod 3$, and $x^2+9y^2\equiv 0, 1, 2\pmod 4$. If this number is prime, then  we have only one possibility:
$$x^2+9y^2\equiv 1 \pmod {12}.$$ 
A: This question (and many others in the same style) pertains to the representation of integers by quadratic norm forms , here $p=x^2+9y^2$ (we can obviously suppose p>3 and x and 3 y coprime). Since 3 and 4 are coprime, the congruence p≡1mod12 is equivalent to the simultaneous congruences p≡1mod3 and p≡1mod4 . Now :
1) p=x2+(3y)2=a2+b2 implies that p≡1mod4 (elementary, no need of Fermat). Moreover, reduction mod 3 gives p≡ x^2mod3  , hence p≡1mod3 
2) Conversely, if p≡1mod4 , p=a2+b2 (Fermat),  a and b coprime , and since p>3, reduction mod 3 gives  either p = 2 a^2 = 2 mod 3, impossible ; or p = a^2=0 mod 3, hence p = x^2 + 9 y^2 QED
(this is just a rewriting of Ivanov and Sokhe)
Besides, from the decomposition of primes in quadratic fields we know that :
1) p≡1mod4 is equivalent to the splitting of p in Q(i) , $i^2 = - 1$, equivalent to $p= x^2 + y^2$ (Fermat's result)
2) p≡1mod3 is equivalent to the splitting of p in Q(j),  j3=1 , equivalent to $p =  x^2 + xy + y^2$ (see e.g. the question posed by user89402 )
So p is represented by the form  x^2 + 9 y^2  in integral variables iff  p is represented simultaneously by the two forms x^2 + y^2  and  x^2 + xy + y^2,  iff p splits simultaneously in Q(i) and Q(j).
What happens if we allow x and y to be no longer integers, but rational numbers ? We still have $p = a^2 + b^2$, a and b rationals, iff p is a norm from Q(i) ; but p is a norm from Q(j) iff $p = a^2 + 3 b^2$ (not the same form as before).  Besides, by Hasse’s norm theorem for cyclic extensions, being a norm globally is equivalent to being a norm locally at every prime of Q – actually, for our extensions, at p, because of ramification properties. 
Conclusion : p is represented by simultaneously by the two forms $a^2 + b^2$ and $a^2 + 3 b^2$ in rational variables iff p is a norm from both $Q_p$(i) and $Q_p$(j).
