## How to generate a finite field in Sage

To generate a field of size $p^n$, for $p$ a prime, input $p$ and $n$ in the first two lines of this box. The field will be called “R”.

The result will give you an element $a$ which is a multiplicative generator (the variable we write polynomials in, instead of $x$). It will tell you the irreducible polynomial in $a$ that was used to create the field.

## Do some arithmetic in your field

Wrapping polynomials in the variable $a$ with the field $R$ will let you do arithmetic.

## Create a finite field with a given irreducible polynomial

If you want to control the irreducible polynomial (instead of letting Sage do it), this box shows how.

## Addition Table for the finite field

The first two lines set up the prime and the polynomial.

## Multiplication Table for the finite field

The first two lines set up the prime and the polynomial.

## Create a polynomial ring over Z/pZ, and factor polynomials or check irreducibility

Other things you might want to do.