Half Catalan triangle by mhib

($a=Array.new(($l=gets.to_i)*2+1){Array.new($l+1,0)})[0][0]=1
0.upto($l*2){|i|0.upto(i/2){|x|$a[i][x]=$a[i-1][x]+$a[i-1][x+(i.odd?? 1: -1)].to_i;$a[i][i/2]=1};puts $a[i].join(' ') if i%2==0}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page