#!/usr/bin/ruby

func floyd(rows, n=1) {
    var max = Math.range_sum(1, rows)
    var widths = (max-rows .. max-1 -> map{ .+ n -> len })
    { |r|
        say %'#{1..r -> map{|i| "%#{widths[i-1]}d" % n++ }.join(" ")}'
    } << 1..rows
}

floyd(5, 88)
