1 | initial version |
It would be interested to know what code you tried and what error you got exactly.
This would make it possible to give you appropriate explanations on what failed in what you tried and why.
The following works for me.
sage: for p in primes_first_n(100):
....: x = polygen(GF(p))
....: print("%4d %s" %(p, (x^2 - 17).factor()))
....:
This runs through the first 100 primes, and for each of them
declares x
as the generator for a polynomial ring over the
finite field with p
elements, and prints out the factorization
of the polynomial x^2 - 17
in that ring.
2 | No.2 Revision |
It would be interested interesting to know what code you tried and what error you got exactly.got.
This would make it possible allow to give you appropriate explanations
on explain precisely what failed in what you tried and why.
The following works for me.
sage: for p in primes_first_n(100):
....: x = polygen(GF(p))
....: print("%4d %s" %(p, (x^2 - 17).factor()))
....:
This runs through the first 100 primes, and for each of them
declares x
as the generator for a polynomial ring over the
finite field with p
elements, and prints out the factorization
of the polynomial x^2 - 17
in that ring.
Note that Zmod(p)
or Integers(p)
creates the ring
of integers modulo p
, considered with its ring structure,
while GF(p)
(for Galois Field) creates it as a field.