Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In your particular case, your equation is a bit weird since:

sage: p == l
True

In particular, p=0 mod l, so there is no hope to find any nonzero k such that pk=1 mod l.

In the more general case, the problem you are trying to solve is called the discrete logarithm. If you had some other numbers, you could have done the following:

sage: a = Mod(1,l)
sage: b = Mod(p,l)
sage: discrete_log(a,b)

As explained before, in this particular example where p=l you get ValueError: No discrete log of 1 found to base 0, which seems normal.