powmod - Maple Help

powmod

power function with remainder

 Calling Sequence powmod(a, n, b, x)

Parameters

 a - polynomial in x n - integer b - polynomial in x x - name

Description

 • The powmod function computes ${a}^{n}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}b$ where a and b are polynomials in x and n is an integer, possibly negative.  The case of n positive could also be computed as $\mathrm{rem}\left({a}^{n},b,x\right)$ but powmod is more efficient and uses the method of binary powering with remainder.

Examples

 > $\mathrm{powmod}\left(x+1,16,{x}^{2}+1,x\right)$
 ${256}$ (1)
 > $\mathrm{powmod}\left(x+1,-2,{x}^{2}-2,x\right)$
 ${-}{2}{}{x}{+}{3}$ (2)