# coding=utf-8 name = 'pascal/3' slug = 'pascal's triangle' description = '''\

The first five rows of the Pascal's triangle look like this:

        1
       1 1
      1 2 1
     1 3 3 1
    1 4 6 4 1

Each row begins and ends with 1. Every other element can be obtained as a sum of the two values above it. Write the predicate pascal(I,J,N) that returns the J-th value in the I-th column of the Pascal's triangle. Your solution should return exactly one answer for any input (the I and J arguments start counting with 0; you can assume that 0 ≤ JI).

  ?- pascal(0, 0, N).
    N = 1.
  ?- pascal(2, 1, N).
    N = 2.
  ?- pascal(4, 3, N).
    N = 4.
''' hint = {}