Background/Motivation
I am advising a number theory project for a group of students. They are going to implement an algorithm to express any prime $p$ congruent to $1$ mod $4$ as a sum of two squares.
One thing they will need to do is to find a square root of $-1$ mod $p$.
My first thought is that since half of the numbers $1,2,3, ...$ are non quadratic residues mod $p$, they can just check $a^{\frac{p-1}{2}}$ mod $p$ for $a = 2, 3, 4, ...$ until they get $-1$. Computing these powers is relatively quick if they express $\frac{p-1}{2}$ in binary and use repeated squaring to find the values $a^{2^n}$ mod $p$.
This leads to the question of "worst case scenarios": what if there is a long string of quadratic residues at the beginning of the sequence?
Question
What is known about the longest string of consecutive quadratic residues mod $p$? Can we say anything about the ratio of this number to $p$ as $p \to \infty$?