[GAP Forum] GAP

Sandeep Murthy s.murthy at mykolab.com
Thu Apr 16 17:35:20 BST 2015


Once you’ve defined the variables a and p you can just do

    gap> a^p mod p = a mod p;

and

   gap> a^(p-1) mod p = 1;

Or you can write a function

    ModuloExpressions := function(x, y, modulo)

        return x mod modulo = y mod modulo;

        end;

where x and y are integers, and modulo is the mod you
want to use, and then call it using

    gap> ModuloExpressions(a^p, p, p );
    gap> ModuloExpressions(a^(p-1),p,1);

Sandeep Murthy
s.murthy at mykolab.com

> On 16 Apr 2015, at 17:22, Wanderley Tiowann <sgwvieira at gmail.com> wrote:
> 
> How can I do this on GAP?   a^p = a (mod p) or a^(p-1) = 1 (mod p)?
> 



More information about the Forum mailing list