11.8.10 Computing
a
n
(mod
p
)
For integers
a
,
n
and
p
, the
powmod
or
powermod
command finds
a
n
(mod
p
).
powmod
takes three arguments:
a
,
n
and
p
, integers.
powmod(
a
,
n
,
p
)
returns
a
n
(mod
p
) in [0,
p
−1].
Examples
powmod
(5,2,13)
12
powmod
(5,2,12)
1