ExpModI function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Math

Package: Microsoft.Quantum.Standard

Returns an integer raised to a given power, with respect to a given modulus.

function ExpModI (expBase : Int, power : Int, modulus : Int) : Int

Description

Let us denote expBase by $x$, power by $p$ and modulus by $N$. The function returns $x^p \operatorname{mod} N$.

We assume that $N$, $x$ are positive and power is non-negative.

Input

expBase : Int

power : Int

modulus : Int

Output : Int

Remarks

Takes time proportional to the number of bits in power, not the power itself.