commands → jacobi

jacobi(a,n)

The jacobi command computes the Jacobi symbol (a | n) where a and n are non-negative integers. When n is prime, the Jacobi symbol indicates whether a is a quadratic residue modulo n.

Examples

jacobi(2,5);
	-1

jacobi(4,5);
	1

References

Link to Handbook of Applied Cryptography