All increasing sequence of length k of first n whole numbers

85 views Asked by At

How can I find all the increasing sequence of length k first n whole number ?

Constraints

1<=k<=2000

1<=n<=2000

for k = 3 n=4

0 0 0 
0 0 1 
0 0 2 
0 0 3 
0 0 4 
0 1 1 
0 1 2 
0 1 3 
0 1 4 
0 2 2 
0 2 3 
0 2 4 
0 3 3 
0 3 4 
0 4 4 
1 1 1 
1 1 2 
1 1 3 
1 1 4 
1 2 2 
1 2 3 
1 2 4 
1 3 3 
1 3 4 
1 4 4 
2 2 2 
2 2 3 
2 2 4 
2 3 3 
2 3 4 
2 4 4 
3 3 3 
3 3 4 
3 4 4 
4 4 4 

Here I can see there is a pattern that sum of occurrence of each number in all the series is same.For the above case all the numbers occurs 21 times overall means :

Occurrence of 0 - 21

Occurrence of 1 - 21

Occurrence of 2 - 21

Occurrence of 4 - 21

Similarly for k=3 n=2

Occurrence of 0 - 15

Occurrence of 1 - 15

Occurrence of 2 - 15

Occurrence of 3 - 15

For k=3 n=3 this number is 10

How can I find this number ?

0

There are 0 answers