Documentation for sub expmod

Documentation for sub expmod, assembled from the following types:

class Int

From Int

(Int) routine expmod

Defined as:

multi sub    expmod(      $x,     $y,     $mod --> Int:D)
multi sub    expmod(Int:D $xInt $yInt $mod --> Int:D)
multi method expmod(Int:D:    Int $yInt $mod --> Int:D)

Returns the given Int raised to the $y power within modulus $mod, that is gives the result of ($x ** $y) mod $mod. The subroutine form can accept non-Int arguments, which will be coerced to Int.

say expmod(425);    # OUTPUT: «1␤» 
say 7.expmod(25);     # OUTPUT: «4␤»