Random Primitive

34 views
Skip to first unread message

Jan Medina

unread,
Apr 19, 2014, 5:56:41 PM4/19/14
to sage-s...@googlegroups.com
Hi everybody.

There is a procedure or library in SAGE that allows finding a random primitive element on a finite field?

leif

unread,
Apr 19, 2014, 6:31:33 PM4/19/14
to sage-s...@googlegroups.com

Jan Medina

unread,
Apr 19, 2014, 7:04:26 PM4/19/14
to sage-s...@googlegroups.com
i know that but this function only give you one generator, always the same but i want a random generator of a multiplicate group of a finite field.

Jan Medina

unread,
Apr 20, 2014, 3:11:47 PM4/20/14
to sage-s...@googlegroups.com
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)

John Cremona

unread,
Apr 20, 2014, 4:00:37 PM4/20/14
to SAGE support
Any reason not to just test r.multiplicative_order() ?

John Cremona
> --
> 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...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

Jan Medina

unread,
Apr 20, 2014, 11:42:53 PM4/20/14
to sage-s...@googlegroups.com
I think this is a fast algorithm. Im not sure what fast can be just testing the multiplicative order
Reply all
Reply to author
Forward
0 new messages