Thank you...I'm wrong. Yes, prime_divisors gives the number of distinct prime divisors (just like the name says).
NS On Mar 9, 4:24 pm, William Stein <[email protected]> wrote: > On Mon, Mar 9, 2009 at 2: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? > > Why do you think len(prime_divisors(x^2)) should be 2? It's 1 since > x^2 has only one prime divisor. > > William > > > > > > > Thanks, > > NS > > > On Mar 9, 1:20 pm, John Cremona <[email protected]> wrote: > >> On 9 Mar, 18:05, YannLC <[email protected]> wrote: > > >> > On Mar 9, 6:38 pm, Nick Alexander <[email protected]> wrote: > > >> > > On 9-Mar-09, at 8:48 AM, Noel wrote: > > >> > > > Hello Y'all, > > >> > > > What's the best way of listing all polynomials of a given degree with > >> > > > coefficients in a finite field? > > >> > > If you want a one liner, you could use > > >> > > sage: [ GF(3)['x'](list(t)) for t in (GF(3)^2) ] > >> > > [0, 1, 2, x, x + 1, x + 2, 2*x, 2*x + 1, 2*x + 2] > > >> > > Nick > > >> > if you want another one liner, and an exact degree, you could use > > >> > list(GF(3)['x'].polynomials(of_degree=2)) > > >> That is better since (without the list) it is an iterator; also you > >> can put in max_degree= instead of of_degree= to get all polys up to a > >> given degree. Someone else must have needed this and implemented it! > > >> John > > >> > Yann > > -- > William Stein > Associate Professor of Mathematics > University of Washingtonhttp://wstein.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
