On Mon, Mar 9, 2009 at 1:21 PM, Noel <noel.sagu...@cox.net> wrote:
>
> Thank you all for your replies!  Now I have another problem:
>
> sage: for f in list(GF(2)['x'].polynomials(of_degree=2)):
> ....:     print len(prime_divisors(f)), f
> ....:
> 1 x^2
> 1 x^2 + 1
> 2 x^2 + x
> 1 x^2 + x + 1
>
>
> Only one of these polynomials should have a 1 in the first column (the
> polynomial that's irreducible).  What am I doing wrong?

prime_divisors() gives you the distinct prime divisors:
sage: prime_divisors(8)
[2]

What do you really want?  If you want the factorization, you can use
factor(f); if you want to know if f is irreducible, you can use
f.is_irreducible().

Carl

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to