3 syntax highlighting

Ruby, 181

def P(a)a.min<0?0:a.max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((0..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i])

def P(a)a.min<0?0:a.max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((0..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i])


The first approach using the following recursive formula

P(...,-1,...) = 0
P(0,0,...,0) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...

P(...,-1,...) = 0
P(0,0,...,0) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1


Ruby, 181

def P(a)a.min<0?0:a.max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((0..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i])


The first approach using the following recursive formula

P(...,-1,...) = 0
P(0,0,...,0) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1


Ruby, 181

def P(a)a.min<0?0:a.max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((0..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i])


The first approach using the following recursive formula

P(...,-1,...) = 0
P(0,0,...,0) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1

2 deleted 1 characters in body

Ruby, 183181

def P(a)a.min<1min<0?0:a.max<2max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((10..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i+1]to_i])


The first approach using the following recursive formula

P(...,0-1,...) = 0
P(10,10,...,10) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1


Ruby, 183

def P(a)a.min<1?0:a.max<2?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((1..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i+1])


The first approach using the following recursive formula

P(...,0,...) = 0
P(1,1,...,1) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1


Ruby, 181

def P(a)a.min<0?0:a.max<1?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((0..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i])


The first approach using the following recursive formula

P(...,-1,...) = 0
P(0,0,...,0) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1

1

Ruby, 183

def P(a)a.min<1?0:a.max<2?1:(b=a*1;t=k=0;b.map{b[k]-=1;k+=1;t+=P(b)};t)end
def d(n,a)print n>1?((1..a[-1]).map{|i|d(n-1,a+[i])};"\n"):"#{P(a)} "end
d(ARGV[0].to_i,[ARGV[1].to_i+1])


The first approach using the following recursive formula

P(...,0,...) = 0
P(1,1,...,1) = 1
P(a,b,c,....) = P(a-1,b,c,...) + P(a-1,b-1,c,...) + P(a-1,b-1,c-1,...) + ...


and then printing row P(R,...).

The output is triangle-like - for pascal 4 2 it looks like

1

3
3 3

3
6 6
3 6 3

1
3 3
3 6 3
1 3 3 1