From the above discussion we see that one natural set of generators is
to pick one prime ideal *P*_{p} lying over each split prime *p* and for
each ramified prime *p*. We only need to consider primes satisfying
the criterion
*p* ; let *S* denote the set of such primes.
Now we need to write relations. Suppose that *T* is the (finite) set
of all integers *n* such that (1) *n* is a multiple of elements of *T*
(2) For each prime divisor *p* of *n*,
*n*/*p* . Each such
*n* can be written uniquely as the norm of an ideal *J*_{n} that is a
product of the ideals *P*_{p}. If we find an element in *J*_{n}
so that
Nm() *n*^{ . }^{ . }, then
= *J*_{n}^{ . }*I*_{n}, where
Nm(*I*_{n}) . We can thus
write a natural factorisation of the ideal in terms of
*P*_{p} and *Q*_{p}. Note that when
*n* , the existence of such
an is guaranteed by the lemma proved in the previous section.
To write these relations, it is sufficient find all numbers less
than
max(*T*) which are products of primes in *S* and write
these elements as norms.

Now suppose we have a relation
*P*_{p}^{np} = *R* with
*n*_{p} 0. If
Nm() , then we can find a factor
*P*_{p}^{mp} which has norm *n* larger than ,
but lying in *T*. Then, we can replace the above relation by

To write the relations associated with elements of *T* as above we
note that for each *n* in *T* we can construct a candidate for
as follows. First of all we use Chinese Remainder theorem
to find an integer *a*_{n} so that
*a*_{n} = *a*_{p}(mod *p*) for every *p*
dividing *n* (if necessary we can actually use Hensel's lemma to
replace *a*_{p} by the root of the equation modulo the maximal power of
*p* that divides *n*). Then, elements of the form *x* + *y* are
candidates where *y* is some number less than *n* and *x* is the
reduction modulo *n* of
*a*_{n}^{ . }*y*. In addition, we can impose the
condition that *x* + *y* lies in a specified region in
^{ . }*K*
with volume *n* (this region is a rectangle in the case
*D*_{R} > 0 and a circle in the case *D*_{R} < 0). These conditions make the
search for effective.

Now the numbers in *T* could be just short of
, so that
the norm of could be just short of
. This is in
general too big a collection of relations to handle. One way to
simplify the approach is to make reductions to the set *S* on the
basis of relations found. Thus, if we find that *P*_{p} has order *k*
based on relations already found then we do not consider numbers *n*
that are divisible by powers of *p* larger than *k* - 1. Similarly, if
we found a relation expression *P*_{p} in terms of smaller primes in the
set *S*, then we can drop multiples of *p* from further choices for
*n* in *T*. Finally, we can use a ``Class Number formula'' to give an
*estimate* in terms of lower and upper bounds for the size of the
group. Once we find a group that is the correct range then there are
techniques to verify that there are no more relations to be
considered.

Thus the techniques described above *could* be used to compute the
class group even for large *D*_{R}. However, the main aim of this
section was to show the *possibility* of making the
computation. We will need some more effective techniques to deal with
finite abelian groups before we can make the computation more
efficient.

As a demonstration we now compute the class group of the discriminant
257. The associated polynomial is *T*^{2} - *T* - 64. The initial
candidates for the set *S* consist of the primes 16, i. e. the
set
{2, 3, 5, 7, 11, 13}. Now, the polynomial becomes *T*^{2} + *T* modulo 2
so that 2 is split so it is in *S*. Now we have

257 | 2(mod 3) | and | 257 | 2(mod 5) |

which shows that 3 and 5 are non-split and thus not in

257 4 | 2^{2}(mod 11) |
and | 257 10 | 6^{2}(mod 13) |

so that 11 and 13 are in

{22 = 2^{ . }11, 26 = 2^{ . }13, 32 = 2^{5}, 121 = 11^{2}, 143 = 11^{ . }13, 169 = 13^{2}}

We now compute the relations in succession. We lift the above roots
0(mod 2) and
7(mod 11) (of the equation