> < ^ Date: Fri, 07 Sep 2001 11:28:42 -0400
> < ^ From: David Joyner <wdj@usna.edu >
^ Subject: discrete log

Hello GAP forum:

I have a student who seems to be interested in
programming the discrete log in GAP for a semester project.
The algorithm the LogMod function uses can be obtained from

function ( n, r, m )
    local  x, l;
    n := n mod m;
    x := 1;
    l := 0;
    while x <> n  do
        x := x * r mod m;
        l := l + 1;
        if l = m  then
            return fail;
    return l;

This looks pretty simple. Would an implementation of
the baby-step giant-step be useful? I remember a recent post
(which I cannot find in the archives or in my saved forum
emails, unfortunately) but baby-step giant-step wasn't mentioned,
if I remember correctly.

- David Joyner

Prof David Joyner, Mathematics Department
U. S. Naval Academy, Annapolis, MD 21402
phone: (410) 293-6738

> < [top]