Things we know from elementary number theory:
- If a prime $p=x^2+y^2$, then $p \equiv 1 \pmod 4$
- Given the above, $(-1 \mid p) = 1$, and $\exists m : [m^2= -1 \pmod p \land 0<m< \frac12 (p-1)]$
I was looking at the relationship between $m$ and $x,y$ in these situations. Assuming WLOG that $x>y>0$, the following hold:
- If $y=1$, then $m=x$ (trivially).
- If $x=y+1$, then $m=x+y$. (Substituting $y=x-1$ shows this.)
After moving numbers around a bit, it seems that in general, $m=ay+bx$ holds, where $a$ and $b$ are the absolute values of the minimal Bezout coefficients for $x$ and $y$.
I haven't worked toward actually proving this, but I suspect this is a well-known result, given its simplicity. Alas, Approach $0$ and Google have let me down in terms of finding info.
Does anyone have a reference (or link to another question) with info on this sort of problem? Is this a lemma/theorem I should know the name of?
Edit: variables reversed, oops.
Edit 2: For absolute clarity, given the definitions above, the following seems to hold true empirically:
$$ux+vy=1 \implies |uy| +|vx| =m$$
But why?
Edit 3: Further tinkering yields further "coincidences." So far as I can tell, for the $4k+1$ primes, $m$ and $-m$ are the unique residues where $-m = m'$. That is, the two square roots of $-1$ mod these primes are additive inverses--which is expected--but also multiplicative inverses. Though now that I consider it, this makes sense: $m^2 \equiv -1 \implies -m^2 \equiv 1 \implies m(-m) \equiv 1 \pmod p$.
But importantly this gives me something else to search for.