Task

Draw a Cantor set.



See details at this Wikipedia webpage:   Cantor set

integer n = 5,
        w = power(3,n-1),
        len = w
string line = repeat('#',w)&"\n"
 
while 1 do
    puts(1,line)
    if len=1 then exit end if
    len /= 3
    integer pos = 1
    while pos<(w-len) do
        pos += len
        line[pos..pos+len-1] = ' '
        pos += len
    end while
end while
