Legendre symbol