P(i,j) = the number at i-th row and j-th column, could be defined as:
P(i, j) = P(i-1, j-1) + P(i-1, j+1) - for the indented pyramid diagram
or
P(i, j) = P(i-1, j-1) + P(i-1, j) - for the non indented triangle (the way it would appear in a basic 2D data structure, eg: int P[][]).
Also, you will have to check if P(i-1,j-1) exists.
P(i,j) = the number at i-th row and j-th column, could be defined as:
P(i, j) = P(i-1, j-1) + P(i-1, j+1) - for the indented pyramid diagram
or
P(i, j) = P(i-1, j-1) + P(i-1, j) - for the non indented triangle (the way it would appear in a basic 2D data structure, eg: int P[][]).
Also, you will have to check if P(i-1,j-1) exists.