Table[Mod[(x^2), 11], {x, 0, 10}]

Union[Table[Mod[(x^2), 123], {x, 0, 122}]]

ListPlot[Table[Mod[(x^2), 667], {x, 0, 666}]]

ListPlot[Table[Mod[(x^2), 10007], {x, 0, 10006}]]

Table[
      Solve[{(x^2) == a, Modulus == 667}, x], {a, 500, 510}]

ModularSqrt[a_, p_] := 
      Module[{liste, x}, 
liste = 
          Table[Mod[(x^2), p], {x, 0, p - 1}]; 
Flatten[
          Position[liste, a] - 1]
]

ModularSqrt[506, 667]

ModularSqrt[509, 667]