This triangle shape full of numbers is the reference I have to use for the first part of a homework problem, but I haven't the slightest clue as to why the rows and columns are indexed starting at zero and what that means in terms of all the other rows.

That being said:

How does P(4,2)=6?

It doesn't make any sense to me.

Note: I used parentheses to make up for the fact that I couldn't type in a small '4' and a small '2'.



Do you have some perl code you need help with?

I've figured out the answer to my previous question, but now have an even bigger problem. The assignment was to create and run a program that can take any column and row then print the corresponding number.

I found this code online. I thinks it's the answer. I don't want the answer. I want to know why and how to do it:


for ($k=0;$k<10;$k++) {
     $pascal[$k] = [];
     push @{$pascal[$k]},1;
     for ($l=1;$l<=$k;$l++) {
        push @{$pascal[$k]},$pascal[$k-1][$l-1]+$pascal[$k-1][$l];

foreach (@pascal) {
        $n_els = @{$_};
        $nsp = 20 - 2 * $n_els;
        $form = (" " x $nsp).("%4d" x $n_els)."\n";
        printf $form, @{$_};

I really need it explained... in absolute layman's terms if it is at all possible.