All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Up and up (Posted on 2010-05-04)
What is the number of non-decreasing sequences of (n+1) integers from 0 to n?

Example: f(2)=10 i.e. (000,001, 002, 011, 012, 022,111,112,122,222))

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution Comment 2 of 2 |

A given non-decreasing sequence can be represented by a sequence of I's and U's, where I represents the placement of an integer and U represents going up by 1 unit in value as the current value to be placed at any given I. Any U's that occur before the first I increase the value of the first integer. If the last integer is lower than n, then the remaining U's occur after the last I.

Thus there are n U's to take the values from 0 to n, and n+1 I's as there are n+1 integers.  The number of such sequences of U's and I's is C(2n+1,n). In the sample case, where n=2, this is C(5,2) = 10, and the correspondence of the two types of sequence is shown:

`000 IIIUU001 IIUIU002 IIUUI011 IUIIU012 IUIUI022 IUUII111 UIIIU112 UIIUI122 UIUUI222 UUIII`

 Posted by Charlie on 2010-05-04 17:32:31

 Search: Search body:
Forums (0)
Random Problem
Site Statistics
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox: