On Tuesday, March 27, 2018 at 12:07:41 AM UTC-7, Ralf Stephan wrote:
>
> Hello,
> I thought I'd try Sage for a casual computation. I was interested in which 
> numbers of the form (2^n - (-1)^n)/3 are prime. I first tried out n=23:
>
> sage: (2^23+1)/3
> 2796203
> sage: _.is_prime()
> False
> sage: factor(2796203)
> 2796203
>
> Just as a data point: my magma initialization file contains:

intrinsic Factorisation(n::FldRatElt) -> SeqEnum
  L,u:=Factorisation(Numerator(n));
  L:= L cat [ <u[1],-u[2]> : u in Factorisation(Denominator(n))];
  return L,u;
end intrinsic;

intrinsic Factorisation(n::FldFunRatMElt) -> SeqEnum
  L,u:=Factorisation(Numerator(n));
  L:= L cat [ <u[1],-u[2]> : u in Factorisation(Denominator(n))];
  return L,u;
end intrinsic;

intrinsic Factorisation(n::FldFunRatUElt) -> SeqEnum
  L,u:=Factorisation(Numerator(n));
  L:= L cat [ <u[1],-u[2]> : u in Factorisation(Denominator(n))];
  return L,u;
end intrinsic;

intrinsic Factor(a::.)->SeqEnum
  return Factorisation(a);
end intrinsic;



just because whenever I want to factor an element from a field of 
fractions, I am interested in the factorization of the numerator and the 
denominator.

I'd be in favor of adapting the globals namespace factorization routine to 
do something similar in sage. I think 

sage: is_prime(12/4)
False

is so bad that it forces us to special-case something in the toplevel 
is_prime as well. I'd hope we can leave the methods as-is. It means that 
library-code should NOT use the top-level is_prime (but it's unlikely it 
does, and it's a bad idea anyway--method versions are very likely more 
efficient and probably more appropriate)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to