$p\equiv 1\pmod 4\Rightarrow p=a^2+b^2$ and $p\equiv 1\pmod 8\Rightarrow p=a^2+2b^2$, what about for $p\equiv 1\pmod {2^n}$ in general Primes $p$ with $p\equiv 1\pmod 4$ can be written as $p=a^2+b^2$ for some integers $a,b$. For $p\equiv 1\pmod 8$ we have $p=a^2+2b^2$. Can primes that satisfy $p\equiv 1\pmod{2^n}$ for $n>3$ be written in a similar form -- for example $p=a^2+4b^2$ for $n=4$?
 A: it gets harder, and we cannot just impose congruence conditions.
Added: one thing I've not seen in print is this: as soon as $p \equiv 1 \pmod 8,$ we find that $-1$ is a fourth power mod $p,$ and
$$ z^4  + 1 \equiv 0 \pmod p  $$
has four distinct roots.
A prime can be expressed as $p = x^2 + 32 y^2$   if and only if $p \equiv 1 \pmod 8$  and
$$ z^4 - 2 z^2 + 2 \equiv 0 \pmod p  $$
has four distinct roots.
A prime can be expressed as $p = x^2 + 64 y^2$   if and only if $p \equiv 1 \pmod 8$  and
$$ z^4 - 2  \equiv 0 \pmod p  $$
has four distinct roots.
The 64 result can be found under "biquadratic reciprocity." Both results may be due to Gauss, but were not published until Jacobi and Eisenstein.
A: Let prime $p=a^2+2^{n-2}\cdot b^2\equiv1\pmod{2^n}$, where $n>4$ and $a,b$ is integers.
Then sequence $(n, min(p))$=(5,97), (6,193), (7,257), (8,257), (9,18433), (10,18433), (11,18433), (12,65537), (13,1097729), (14,65537), (15,1179649), (16,65537), (17,1179649), (18,26214401), (19,117964801), (20,26214401), (21,169869313), (22,104857601), ....
gp-code:
nminp()=
{
 for(n=5,100,
  forprime(p=3,10^9,
   m= 2^n;
   if(Mod(p,m)==1,
    if(#thue('x^2+m/4, p),
     print1("("n","p"), ");
     break()
    )
   )
  )
 )
};

