Finite prime fields#

AUTHORS:

  • William Stein: initial version

  • Martin Albrecht (2008-01): refactoring

class sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn(p, check=True, modulus=None)#

Bases: FiniteField, IntegerModRing_generic

Finite field of order \(p\) where \(p\) is prime.

EXAMPLES:

sage: FiniteField(3)
Finite Field of size 3

sage: FiniteField(next_prime(1000))                                             # needs sage.rings.finite_rings
Finite Field of size 1009
characteristic()#

Return the characteristic of code{self}.

EXAMPLES:

sage: k = GF(7)
sage: k.characteristic()
7
construction()#

Returns the construction of this finite field (for use by sage.categories.pushout)

EXAMPLES:

sage: GF(3).construction()
(QuotientFunctor, Integer Ring)
degree()#

Return the degree of self over its prime field.

This always returns 1.

EXAMPLES:

sage: FiniteField(3).degree()
1
gen(n=0)#

Return a generator of self over its prime field, which is a root of self.modulus().

Unless a custom modulus was given when constructing this prime field, this returns \(1\).

INPUT:

  • n – must be 0

OUTPUT:

An element \(a\) of self such that self.modulus()(a) == 0.

Warning

This generator is not guaranteed to be a generator for the multiplicative group. To obtain the latter, use multiplicative_generator() or use the modulus="primitive" option when constructing the field.

EXAMPLES:

sage: k = GF(13)
sage: k.gen()
1

sage: # needs sage.rings.finite_rings
sage: k = GF(1009, modulus="primitive")
sage: k.gen()  # this gives a primitive element
11
sage: k.gen(1)
Traceback (most recent call last):
...
IndexError: only one generator
is_prime_field()#

Return True since this is a prime field.

EXAMPLES:

sage: k.<a> = GF(3)
sage: k.is_prime_field()
True

sage: # needs sage.rings.finite_rings
sage: k.<a> = GF(3^2)
sage: k.is_prime_field()
False
order()#

Return the order of this finite field.

EXAMPLES:

sage: k = GF(5)
sage: k.order()
5
polynomial(name=None)#

Returns the polynomial name.

EXAMPLES:

sage: k.<a> = GF(3)
sage: k.polynomial()
x