Any reason not to just test r.multiplicative_order() ? John Cremona
On 20 April 2014 20:11, Jan Medina <[email protected]> wrote: > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
