Task
Produce an ASCII representation of a Sierpinski triangle of order   N.



Example
The Sierpinski triangle of order   4   should look like this:

                       *
                      * *
                     *   *
                    * * * *
                   *       *
                  * *     * *
                 *   *   *   *
                * * * * * * * *
               *               *
              * *             * *
             *   *           *   *
            * * * *         * * * *
           *       *       *       *
          * *     * *     * *     * *
         *   *   *   *   *   *   *   *
        * * * * * * * * * * * * * * * *



Related tasks
 Sierpinski triangle/Graphical for graphics images of this pattern. 
 Sierpinski carpet


$ include "seed7_05.s7i";
 
const func array string: sierpinski (in integer: n) is func
  result
    var array string: parts is 1 times "*";
  local
    var integer: i is 0;
    var string: space is " ";
    var array string: parts2 is 0 times "";
    var string: x is "";
  begin
    for i range 1 to n do
      parts2 := 0 times "";
      for x range parts do
        parts2 &:= [] (space & x & space);
      end for;
      for x range parts do
        parts2 &:= [] (x & " " & x);
      end for;
      parts := parts2;
      space &:= space;
    end for;
  end func;
 
const proc: main is func
  begin
    writeln(join(sierpinski(4), "\n"));
  end func;