Oh sorry, this is random_primitive
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)

Im using SAGE 5.11 in VirtualBox, my SO is Windows 7.
El domingo, 20 de abril de 2014 22:39:14 UTC-5, William escribió:
>
> On Sun, Apr 20, 2014 at 8:36 PM, Jan Medina <[email protected]<javascript:>> 
> wrote: 
> > I have this error when i runnig this algorithm 
> > 
> > def Trujillo_Gomez(p,h): 
> >     if is_prime(p): 
> >         F.<x>=GF(p^(h-1),name='x') 
> >         g=random_primitive(p,h-1); 
> >         s=p^(h-1) 
> >         for i in range(p): 
> >             a1=discrete_log(g+i,g) 
> >             a2=a1-i 
> >             a3=s*a1+i 
> >             A2=A2+[ZZ(mod(a1,(p*(s-1))))] 
> >         aP=Permutations(A2).random_element() 
> >         return aP 
> >     else: 
> >         print 'P debe ser primo' 
> > 
> > for p=409 y h=17. 
> > 
> > Is it a bug? 
>
> I get the error 
>
>
>    NameError: global name 'random_primitive' is not defined 
>
> What is random_primitive?  Is that defined elsewhere in your code?  If 
> not, exactly what version of Sage are you using, and on exactly which 
> operating system, etc.?  Did you install a binary (which, exactly?) or 
> build from source? 
>
> Thanks, 
>
> William 
>
>
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to 
> > [email protected]<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William Stein 
> Professor of Mathematics 
> University of Washington 
> http://wstein.org 
>

-- 
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.

Reply via email to