information:filtering, stylistic:tone, quality:correction
Computational example

The above properties, including the law of quadratic reciprocity, can be used to evaluate any Legendre symbol. For example:

Or using a more efficient computation:

The article Jacobi symbol has more examples of Legendre symbol manipulation.

Since no efficient factorization algorithm is known, but efficient modular exponentiation algorithms are, in general it is more efficient to use Legendre's original definition, e.g.

using repeated squaring modulo 331, reducing every value using the modulus after every operation to avoid computation with large integers.