I looked at your problem and I really don’t know much about mod I tried it in my good friend Maple. It gave me some answer for 11^b mod 13 in under a second. Still I didn’t understand it so I looked at the help file. This has to be the most cryptic help file I have EVER seen… take a look
mod, modp, mods - computation over the integers modulo m
Calling Sequence:
e mod m
modp(e, m)
mods(e, m)
mod
(e, m)
Parameters:
e - an algebraic expression
m - a nonzero integer
Description:
The mod operator evaluates the expression e over the integers modulo m. It incorporates facilities for doing finite field arithmetic and polynomial and matrix arithmetic over finite fields, including factorization.
The operator syntax e mod m is equivalent to the function call mod
(e,m). The environment variable mod
may be assigned either the modp function or the mods function. When assigned the value modp (the default), the positive representation for integers modulo m is used; i.e. all rational coefficients will be reduced to integers in the range [0,abs(m)-1]. When assigned the value mods, the symmetric representation is used; i.e. all rational coefficients will be reduced to integers in the range [-iquo(abs(m)-1,2), iquo(abs(m),2)].
If the modulus m is a prime integer, then all coefficient arithmetic is done in the finite field of integers modulo m. Elements of finite fields of characteristic m with q = m^n elements are represented as polynomials in alpha where alpha is a simple algebraic extension over the integers mod m. The extension alpha is a RootOf a monic univariate irreducible polynomial of degree n over the integers mod m. See RootOf and the examples below.
The following functions for polynomial and matrix arithmetic over finite rings and fields are known to mod.
To compute i^n mod m where i is an integer, it is undesirable to use this ``obvious’’ syntax because the powering will be performed first over the integers (possibly resulting in a very large integer) before reduction modulo m. Rather, the inert operator &^ should be used: i &^ n mod m. In the latter form, the powering will be performed intelligently by the mod operation. Similarly Powmod(a,n,b,x) mod m computes Rem(a^n,b,x) mod m (where a and b are polynomials in x) without first computing a^n mod m.
Other modular arithmetic operations are stated in their natural form:
i+j mod m; i-j mod m; i*j mod m;
j^(-1) mod m; i/j mod m;
where the latter case will perform i*j^(-1) modulo m.
The left precedence of the mod operator is lower than (less binding strength than) the other arithmetic operators. Its right precedence is immediately higher than +, - and lower than *, / .
There is an interface for user-defined mod functions. For example, if the user has defined the procedure mod/f
then the operation f(x,y) mod 23 will generate the function call mod/f
(x,y,23).
The mod operator is mapped automatically onto equations, the coefficients of polynomials, and the entries of lists and sets.
Because mod is an environment variable, any assignments to it inside a procedure body are undone on exit from the procedure.
Examples:
modp(12,7);
5
12 mod 7;
5
mods(12,7);
-2
1/3 mod 7;
5
5*3 mod 7;
1
5 &^ 1000 mod 100;
25
a := 15x^2+4x-3 mod 11;
2
a := 4 x + 4 x + 8
mod
:= mods:
> b := 3x^2+8x+9 mod 11;
2
b := 3 x - 3 x - 2
> gcd(a,b);
1
> g := Gcd(a,b) mod 11;
g := x + 5
> Divide(a,g,‘q’) mod 11;
true
> q;
4 x - 5
> factor(x^3+2);
3
x + 2
> Factor(x^3+2) mod 5;
2
(x - 2) (x + 2 x - 1)
> alias(alpha=RootOf(y^2+2*y-1)):
> Normal(1/alpha) mod 5;
alpha + 2
> Factor(x^3+2,alpha) mod 5;
(x + alpha + 2) (x - alpha) (x - 2)
> Expand(%) mod 5;
3
x + 2