William corrected my mistake. The code was working correctly. I wanted the number of distinct prime divisors of each f. That's exactly what the code was giving me.
Thank you for replying! NS On Mar 9, 4:29 pm, Carl Witty <[email protected]> wrote: > On Mon, Mar 9, 2009 at 1:21 PM, Noel <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
