------art_20146_8801748.1151267058623
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

My code(in the spirit of golf,as ever)

def c(r,i)[r,i].min||r ?1:c(r-1,i)+c(r-1,i-1)end
def d(n)w
th.log10(c(n,n/2)).ceil+1;(0..n).map{|z|print "
"*((n-z)*w/2);(1..z).map{|b|printf("%#{w}d",c(z,b))};puts}end
d(5)

Or just code to generate the triangle:
def c(r,i)[r,i].min||r ?1:c(r-1,i)+c(r-1,i-1)end
def g(n)(1..n).map{|i|(1..i).map{|b|c(i,b)}}end

Another fun quiz!

j`ey
http://www.eachmapinject.com

On 6/25/06, Erik Veenstra <erikveen / dds.nl> wrote:
>
> >  fac  ambda{|n| n < 2 ? 1 : (1..n).inject{|f, i| f * i}}
> >  tri  ambda{|n, r| fac[n] / (fac[r] * fac[n-r])}
> >  size  ambda{|r| tri[r-1, r / 2].to_s.size + 1}
> >  line  ambda{|y, r| (0..y).map{|x| tri[y,x].to_s.center size[r]}}
> >  lines  ambda{|r| (0...r).map{|y| line[y, r]}}
> >  pascal  ambda{|r| lines[r].map{|l| l.join.center(size[r] *
> r).rstrip}}
> >
> >  puts pascal[(ARGV[0] || 15).to_i]
>
> Nice, but very, very slow...
>
> gegroet,
> Erik V. - http://www.erikveen.dds.nl/
>
>
>
>

------art_20146_8801748.1151267058623--