def legendre_symbol(a, p):
    ls = pow(a, (p - 1) / 2, p)
    return -1 if ls == p - 1 else ls
Compute the Legendre symbol a|p using
dataset/ETHPy150Open bitxbay/BitXBay/electru/build/lib/electrum/msqr.py/legendre_symbol