On Sep 28, 2006, at 1:23 AM, Michael Ulm wrote:

> Not very impressive, but may give others some ideas.
>
> def f(n,m,k,o)
> n*m==0?[]:(k>0?f(n-1,m-1,m-k-1,n+m-1+o).reverse<< n+k+o:(o+1..n 
> +o).to_a)
> end
> x,y=ARGV.map{|t|t.to_i}
> y.times{|i|puts f(x,y,i,0).map{|t|t.to_s.rjust((x*y).to_s.size)}*" "}

I haven't figured out completely how it works yet, but I did shave  
some bytes off of it:

def f n,m,k,o
n*m==0?[]:(k>0?f(n-1,m-1,m-k-1,n+m-1+o).reverse<< n+k+o:(o+1..n+o).to_a)
end
x,y=$*.map{|t|t.to_i}
y.times{|i|puts f(x,y,i,0).map{|t|"%#{"#{x*y}".size}s"%t}*" "}

James Edward Gray II