It seems that Gauss states the following theorem in his first paper on biquadratic residues(Werke vol. II pp. 67-92). I cannot read Latin, but I have a Japanese translation of the paper. However, it is difficult to decipher the paper even in Japanese. Is the theorem right? If yes, how do you prove it?

**Theorem** Let $p$ be a prime of the form $p = 4n+1$. Let $g$ be a primitive root mod $p$. Let $f\equiv g^{(p−1)/4}$ (mod $p$). Then $f^2\equiv −1$ (mod $p$). It is well known that $p=x^2+y^2$ has an integer solution $(a,b)$. Suppose $a$ is odd and $b$ is even. $a$ is uniquely determined by the condition $a\equiv 1$ (mod $4$). $b$ is uniquely determined by the condition $b\equiv af$ (mod $p$). Suppose $2\equiv g^\lambda$ (mod $p$). Then $\lambda\equiv b/2$ (mod $4$).

**Remark**
I asked the same question in Math StackExchange.
Since nobody answered it so far and it seems that the question is highly non-trivial, I post this question here.
Since I was suspended recently there, I'd appreciate if somebody would kindly add the link of this question to my question there.

This is a related question in MSE: https://math.stackexchange.com/questions/470976/the-number-of-solutions-of-ax4-by4-equiv-1-mod-p-for-a-prime-of-the-f

NOTMSE. $\endgroup$ – Makoto Kato Aug 21 '13 at 1:37