\startbuffer[fig121]
numeric n,r,s,u,dx,dy,tt; u := 1.8cm;
path p, q;
pair A,B,start,now;
A := dir(210)*u;
B := dir(-30)*u;
dy := sind(30)*u;
dx := 2*cosd(30)*u;
for n=0 upto 4:
start := n*dir(210)*u;
for r=0 upto n:
s := n-r;
% tt := lua("mp.print(P.fact(" & decimal n & ")/(P.fact(" & decimal r & ")*P.fact(" & decimal s &" )))");
tt := lua("mp.print(P.ncr(" & decimal n & "," & decimal r & " ))");
now := start+r*right*dx;
dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& decimal tt & "$"),now);
draw now -- (now+A);
draw now -- (now+B);
endfor;
endfor;
\stopbuffer