. . . mod $p$, of course, for $p$ prime and equal to 1 mod 4.
For any prime $p$ which is 1 mod 4, $-1$ has a square root in $\mathbb{Z}/p\mathbb{Z}$. But it quickly gets frustrating to find the precise value of $\sqrt{-1}$ in $\mathbb{Z}/p\mathbb{Z}$ by hand. My question is: is there a snappy way to do this?
To make this precise, let me ask a question I'm sure the answer to which is no:
Is there an elementary function $f$ such that, for each prime $p$ which is 1 mod 4, we have $[f(p)]^2=-1$ (mod $p$), where $[\cdot]$ is the "nearest integer" function?
(I'm using the precise meaning of "elementary function" here: https://en.wikipedia.org/wiki/Elementary_function. Note that elementary functions in general take values in $\mathbb{C}$; so tweak the "nearest integer" function appropriately: for $c$ complex, $[c]$ is the least integer $z\in\mathbb{Z}$ (not $\mathbb{Z}+\mathbb{Z}i$) such that $\vert c-z\vert$ is minimal.)