I did this algorithm to find a primitive element of a multiplicative group on a finite field. This is a basic algorithm def random_primitive(p,h): F.<x>=GF(p^h) s=p^h-1 r=F.random_element() j=0 if r!=0: for t in prime_factors(s): if r^(s/t)==1: j=j+1 if j==0: return r else: return random_primitive(p,h) else: return random_primitive(p,h)
-- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.