# Ideals of ${\mathbb{Z}}$

The theory of ideals of ${\mathbb{Z}}$ is very elementary but for completeness the general machinery for ring ideals applies. Such ideals will have type `RngInt`, that is, the same type as the ring of integers itself (`ideal<Integers() | 1>`).

In the case of ${\mathbb{Z}}$ any subring is an ideal so that the `sub`-constructor creates the same object as does the `ideal`-constructor. One quirk of this fact that ideals are of type `RngInt` is that taking $R/I$ will result in the *ideal division* rather than the ring-by-ideal quotient (this is for compatibility with orders of number fields, as explained in the next section). Here is an example that shows the difference.

```
> Z := Integers();
> I := ideal<Z|1>; // ideal of Z
> Z/I; // interpreted as ideal division
Integer Ring
> quo<Z|I>; // quotient of ring by ideal
Residue class ring of integers modulo 1

```

## `ideal< R | a >: RngInt, RngIntElt -> RngIntRes`

Given the ring of integers ${\mathbb{Z}}$ and an integer $a$, return the ideal of ${\mathbb{Z}}$ generated by $a$.

## `Example: Residue Ring (ex-1aa6f6)`

We construct some ideals of ${\mathbb{Z}}$.

```magma
> Z := IntegerRing();
> I13 := ideal< Z | 13 >;
> I13;
Ideal of Integer Ring generated by 13
> 1 in I13;
false
> 0 in I13;
true
> -13 in I13;
true
> I0 := ideal< Z | 0 >;
> 0 in I0;
true
> 1 in I0;
false

```

We check that ${\mathbb{Z}}$ is regarded as an ideal.

```magma
> I1 := ideal< Z | 1 >;
> I1 eq Z;
true

```
