<s>[INST] $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$?
 [/INST] 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()
    )
   )
  )
 )
};

</s>