

sub choose {
  my ($n, $k) = @_;
  my $r = 1;
  while ($k) { $r *= $n--; $r /= $k-- }
  $r;
}

for my $n (0..7) {
  for my $k (0 .. $n) {
    printf "%3d ",  choose($n, $k);
  }
  print "\n";
}
