0
$\begingroup$

This question already has an answer here:

enter image description here

Hello, I've gotten far on this exercise, with the following insight:

Here is a matrix of examples (vertical-axis is n=1,2,3,4,5,6,7,8; horizontal-axis is k=1,2,3,4)

1: 1 1 1 1

2: 2 3 4 5

3: 3 6 10 15

4: 4 10 20 35

5: 5 15 35 70

6: 6 21 56 126

7: 7 28 84 210

8: 8 36 120 330

Now, there is an obvious pattern among the numbers, being triangular numbers, sum of triangular numbers, sum of sum of triangular numbers, and so on. My question is:

Can you help me find closed form expressions for the sums of the entries:

  1. Down the columns
  2. Across the rows
  3. And for general n,k?

Thanks!

$\endgroup$

marked as duplicate by Chris Eagle, Amzoti, Mark Bennet, Thomas, Asaf Karagila Jul 21 '13 at 17:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0
$\begingroup$

Hint: If the print statement read

println(i_k,i_{k-1} + 1, i_{k-2} +2,..., i_2+k-2, i_1+k-1)

then the code would output all possible chices of $k$ distinct elements $\in\{1,\ldots , n+k-1\}$.

$\endgroup$