I am currently working on finding sequences of strings from a Pascal triangle. I wanted to enter a line number and print a sequence of numbers in the list before that line. For example, it (Pascal 4)will give a result (1 1 1 1 2 1 1 3 3 1).
I am trying to use the algorithm I found. Here is the algorithm itself:
V c = V c-1 * ((rc) / c)
r and c must be rows and columns, and V 0 = 1. The algorithm can be defined on the wikipedia page in the section "Calculation and an individual series or diagonal".
Here is the code that I still have:
(define pascal n)
(cond((zero? n) '())
((positive? n) (* pascal (- n 1) (/ (- n c)c))))
I know that hardly anything, but I struggle a lot for trying to find a function with letor lambdato include column values. In addition, I also struggled with recursion. I do not know how to set up a basic example and how to proceed to the next step. Basically, I'm lost everywhere. I know that this does not show much, but any step in the right direction would be greatly appreciated.
source
share