Floyd's triangle   lists the natural numbers in a right triangle aligned to the left where

 the first row is   1     (unity)
 successive rows start towards the left with the next number followed by successive naturals listing one more number than the line above.


The first few lines of a Floyd triangle looks like this:

 1
 2  3
 4  5  6
 7  8  9 10
11 12 13 14 15



Task

 Write a program to generate and display here the first   n   lines of a Floyd triangle. 
(Use   n=5   and   n=14   rows).
 Ensure that when displayed in a mono-space font, the numbers line up in vertical columns as shown and that only one space separates numbers of the last row.


floyd = cluster is triangle
    rep = null
 
    width = proc (n: int) returns (int)
        w: int := 1
        while n >= 10 do    
            w := w + 1
            n := n / 10
        end
        return (w)
    end width
 
    triangle = proc (rows: int) returns (string)
        ss: stream := stream$create_output()
        maxno: int := rows * (rows+1)/2
        num: int := 1
        for row: int in int$from_to(1, rows) do
            for col: int in int$from_to(1, row) do
                stream$putright(ss, int$unparse(num), 1 + width(maxno-rows+col))
                num := num + 1
            end
            stream$putl(ss, "")
        end
        return (stream$get_contents(ss))
    end triangle
end floyd
 
start_up = proc ()
    po: stream := stream$primary_output()
    stream$putl(po, floyd$triangle(5))
    stream$putl(po, floyd$triangle(14))
end start_up