Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found my mistake. In the end there was no error, only, that the programm did not give any primitive root. That's because the

c=True

Must lie inside the first loop. Otherwise it was all the time False if it did not work out once. So the correct version is:

for x in range(1,p):
  c=True
  for pi in list:
    a = (p-1)/pi
    if a == int(a):
        k = R(x^a)
        if k==1:
            c=False
        else:
            print k
    else:
        pass
 if c==True:
    print 'Lösung:', x
    break
 else:
    print c, x