0
$\begingroup$

I am trying to solve a problem that requires me to find b^e mod m, where b is a rational base, e is a rational exponent, m is an integer, b^e can get really large.

I have tried the binary method and the memory efficient method described in this Wikipedia Page , however both algorithms do not support rational exponents (in binary approach, you can't convert rational number into binary, and for memory efficient, you can loop between rational numbers)). Is there any other method/algorithm that supports rational number (excluding the inefficient straight forward method)?

  • 0
    As you say: Taking natural number powers is the scope of binary exponentiation, and doesn't allow taking roots (fractional exponents). You should clarify what kind of thing $b$ is. Is it an integer? What is known about the denominator of $e$ in simplest form?2017-02-18
  • 0
    @hardmath Thanks for the suggestion. Is the question clearer now?2017-02-18
  • 0
    If the denominator of $b$ is coprime to $m$ then you might want to replace it with the corresponding residue mod $m$. Are you familiar with this idea?2017-02-18
  • 0
    @harmath sorry, I am not.2017-02-18
  • 0
    The issue is what do you think $1.5 \bmod 3$ or similar expressions ought to mean, before tackling "powers" of the underlying value. A residue mod $m$ ought to be one of the $m$ equivalence classes given by $x \equiv y \bmod m$.2017-02-18
  • 0
    @hardmath wouldn't 1.5 mod 3 = 1.5 and for another example, say 6.5 mod 3 = 0.5? (**6.5 /3** = 2 1/6 or 2 (0.5)/3 )2017-02-18
  • 0
    If you were merely adding values, this could be made to work. But when you introduce multiplication of values, it makes the residues ill-defined. You compute $(6.5/3)\equiv (13/6) \bmod 3$, but $13\equiv 1 \bmod 3$ so that $(2\; 1/6)\equiv (1/6)\bmod 3$??2017-02-19

0 Answers 0