Previous Up Next

5.36.9  Power in ℤ/pℤ and in ℤ/pℤ[x]: ^

To compute a to the power n in ℤ/pℤ, we use the operator ^. Xcas implementation is the binary power algorithm.
Input:

(5%13)^2

Output:

-1%13

To compute A to the power n in ℤ/pℤ[x], we use the operator ^ and the normal command .
Input:

normal(((2*x+1)%13)^5)

Output:

(6%13)*x^5+(2%13)*x^4+(2%13)*x^3+(1%13)*x^2+(-3%13)*x+1%13

because 10=−3 (mod 13), 40=1 (mod 13), 80=2 (mod 13), 32=6 (mod 13).


Previous Up Next