The following code doesn't work inside Sage Math Cell. I am getting message: TypeError: Check() missing 1 required positional argument: 'n' . I guess I use a selector incorrectly. How can I fix it?
gp.eval("xmat(r,n) = [2*x, -1; 1, 0]*Mod(1,x^r-1)*Mod(1,n);") gp.eval("smallestr(n)={if(n==1 || n%2==0, return(0));forprime(r = 3, oo,my(u=n%r);if (u==0 && r < n, return(0));if (u!=0 && u!=1 && u!=r-1, return(r)));}") gp.eval("myisprime(n)={my(r = smallestr(n));if (r == 0, return(n == 2));my(xp = xmat(r,n)^n*[x,1]~);xp[2] == Mod(x*Mod(1,n),x^r-1)^n;}") def Check(n): if gp.function_call("myisprime",[n]).sage()==true: return ("Prime!") else: return ("Composite!") @interact def _(n=2017,action=selector(['Check'],buttons=True,label='')): action = eval(action) print (action()) -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/71036036-d5a6-420d-b47d-f465e89f02fa%40googlegroups.com.