All published worksheets from http://sagenb.org
def dl(a,b,m): i=1 while mod(b^i,m)<>a: i=i+1 return i