    int i;
    int j;
    int gap;
    int k;

    char x;
    char a[5];

    a[0] = 9; a[1] = 5; a[2] = 3; a[3] = 2; a[4] = 1;

    for (k=0; k < 5; k++)
    {
      gap = a[k];

      for (i=gap; i < ARRAYSIZE; i++)
      {
        x = GetNumber(i);
        for (j=i-gap; x < GetNumber(j) && j >= 0; j=j-gap)
        {
          SetNumber(j+gap,GetNumber(j));
        }
      SetNumber(j+gap,x);
      }
    }
