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

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


   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;


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

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

Forum mailing list

Reply via email to