faster ``quadratic_residue``
added documentation