On Mon, Mar 9, 2009 at 2: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?

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 <john.crem...@gmail.com> wrote:
>> On 9 Mar, 18:05, YannLC <yannlaiglecha...@gmail.com> wrote:
>>
>>
>>
>> > On Mar 9, 6:38 pm, Nick Alexander <ncalexan...@gmail.com> 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 Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
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