# [GAP Forum] Generating Full Factorial Designs Using Nested Loops

Bulutoglu Dursun A Civ AFIT/ENC Dursun.Bulutoglu at afit.edu
Fri Dec 31 02:54:58 GMT 2004

```	Dear Gap Forum,
I would like to write a function in GAP that will do the
following computation:

Input: g_1, g_2,  ..., g_t, a_1,a_2, ...,a_t

Output:

U_{0 =<b_1=<g_1}  U_{0 =<b_2=<g_2} ... U_{0 =<b_t=<g_t}
a_1*b_1+a_2*b_2+...+a_t*b_t

Where U_{0 =<b_1=<g_1}  U_{0 =<b_2=<g_2} ... U_{0
=<b_t=<g_t} is a nested union and the indices of the union are b_1 b_2
...b_t. This is a union of (g_1+1)*(g_2+1)*...*(g_t+1) numbers some of
which could be the same. I was wondering how such a function could be
written in GAP efficiently.
This can be done by using nested loops but the number of
loops necessary is a part of the input.

Note that the index vectors (b_1,b_2,...,b_t) run over
the
(g_1+1)*(g_2+1)*...*(g_t+1) different runs of a t factor
full factorial design where the first factor has (g_1+1) levels, the
second factor has (g_2+1) levels .... and the t'th factor has (g_t+1)
levels.
If such a design can be generated easily in GAP then I
can write the function I am looking for.

Thanks a lot for your attention.
Dursun.

```