0

How do you find the number of unique integer sequences of a nondecreasing sequences length $n$ with these conditions?

$$ a_{n+1} \geq a_{n}$$

Possible rephrasing: Given a particular nondecreasing sequence of length $n$ $\{a_1,a_2, \ldots,a_n\}$, how many nondecreasing sequences $\{b_1,b_2, \ldots ,b_n\}$ are there in which $b_i \leq a_i$ for $1 \leq i \leq n$?

The sequence is sorted low to high and the next number is same or higher.

[1,2,3,4,5] or [1,1,2,2,5] or [5,5,5,5,5]

The permutations must be lower than the sequence, but same or higher than the number before it.

For [1,2,3,4,5] there are 42 unique combinations.

1,1,1,1,1
1,1,1,1,2
1,1,2,2,5
1,1,3,4,5
1,2,3,4,5

1,1,3,2,4 - no because 2 is less than 3
1,3,3,4,5 - no because 3 is greater than 2 in 1,*2*,3,4,5

For 5,5,5,5,5 there are 126 unique sequences.

1,1,1,1,1
1,2,3,4,5
5,5,5,5,5

Brute force counting looks like

for a = 1 to 5
 for b = a to 5
   for c = b to 5
      for d = c to 5
         for e = d to 5
               count++
               print a,b,c,d,e

For [5] the count is 5.

For [1,5] or [1,1,1,1,5] the count is 5.

For [5 repeating n times]

n count
1 5
2 15
3 35
4 70
5 126
6 210
7 330
8 495
9 715
10 1001

I tried summation of summation of summation. $n(n+1)(n+2)(n+3)/2*3*4$

3 summations counts sequences length 5 and limits are $n,n,n,n,n$. 4 summations counts 6. 5 summations counts 7.

I don’t know how to subtract sequences if the limits are $1,2,3,4,5$.

how do you get $\frac{10!}{5!6!} = 42$ from $1,2,3,4,5$ and $\frac{9!}{4!5!} = 126$ from $5,5,5,5,5$?

N. F. Taussig
  • 76,571
  • I'm not sure I follow. If you give me a set of numbers (any integers, any order), there is only one way to order them in non-decreasing order. I don't understand what you mean in the examples. [1, 1, 1, 1] is not a permutation of [5, 5, 5, 5, 5] ... – Matti P. Jun 07 '19 at 07:57
  • My guess is that you're not really talking about permutations, but just sequeces in general. Perhaps your real question is: How many integer sequences are there of length $n$ so that $a_{n+1} \geq a_{n}$? – Matti P. Jun 07 '19 at 07:58
  • I mean permutations of numbers not higher than [5,5,5,5]. I guess the word is sequence then? – Traffic Jun 07 '19 at 08:03
  • I think it would be useful to think about the differences between the subsequent terms. So for each sequence in your desired set of sequences, you can construct an alternate sequence that is just $b_n = a_n - a_{n-1}$ and $b_n \geq 0$ makes sure that it's non-descending. Perhaps this kind of idea would lead you somewhere ... And if you want to limit the maximum value in $a_n$, you just have to set $b_0 + b_1 + \ldots + b_{max} = M$, where $M$ is the maximum value. – Matti P. Jun 07 '19 at 08:06
  • 1
    For a $1,2,\ldots,n$ type constraint the answer is a Catalan number. For a $k,k,\ldots,k$ type constraint, the answer is also simple. It might be worth doing a few small examples to spot the pattern – Henry Jun 07 '19 at 08:14
  • Why wouldn't $1,1,1,2,2$ be considered for $[5,5,5,5,5]$? – David P Jun 07 '19 at 08:15
  • 1,1,1,2,2 is considered for 5,5,5,5,5 – Traffic Jun 07 '19 at 08:18
  • If I understand what you are trying to ask correctly, you should read the second part of my answer to this question. Note that the number of nondecreasing sequences of length $5$ that can be formed with the numbers $1, 2, 3, 4, 5$ is actually $126$. – N. F. Taussig Jun 07 '19 at 08:45
  • 1
    It should be 42. How would you word it to say 1,2,2,2,2 is counted once? Unique nondecreasing sequence of length 5? 5,5,5,5,5 is 126. – Traffic Jun 07 '19 at 09:09
  • @Traffic Note that $42=\frac{10!}{5!6!}$ and $126=\frac{9!}{4!5!}$. These are not coincidences – Henry Jun 07 '19 at 09:18
  • Possible rephrasing: Given a particular nondescending sequence of length $n$, ${a_1, a_2, \ldots, a_n}$, how many nondescending sequences ${b_1, b_2, \ldots, b_n}$ are there in which $b_i \leq a_i$ for $1 \leq i \leq n$? – N. F. Taussig Jun 07 '19 at 09:21
  • This tutorial explains how to typeset mathematics on this site. – N. F. Taussig Jun 07 '19 at 09:22
  • @Henry how do you get 10!/5!6! from 1,2,3,4,5 and 9!/4!5! from 5,5,5,5,5? – Traffic Jun 07 '19 at 09:28
  • I never understood what the word "unique" means in an enumeration problem. Are some sequences not unique so that we should exclude them? As for "non descending" (do you mean "non decreasing"?) see this question. – Marc van Leeuwen Jun 07 '19 at 10:02
  • I tried to say don’t count 1,2,2 twice. I guess enumeration problems doesn’t count the same numbers twice as in permutation problems. Yes, I mean non-decreasing. – Traffic Jun 07 '19 at 10:07
  • @Traffic: $1,2,3$ has $\frac{6!}{3!4!}=5$ possibilities, $1,2,3,4$ has $\frac{8!}{4!5!}=14$ possibilities, also Catalan numbers. $k,k,\ldots,k$ ($n$ times) has ${n+k-1 \choose k}$ possibilities – Henry Jun 07 '19 at 10:13
  • @Henry for (k,k,k.. n times) should it be ( n+k-1 over n )? – Traffic Jun 07 '19 at 15:30
  • @Traffic - possibly yes or equivalently ${n+k-1 \choose k-1}$ – Henry Jun 07 '19 at 15:33
  • Is there a way to combine the sequence count for 2,2,2,5,5,5 using (2+3-1, 3) and (5+3-1, 3)? – Traffic Jun 07 '19 at 15:42

1 Answers1

1

Answering this question in general is probably just too difficult, so I'll just restate the problem into a maybe more understandable form. If you arrange $a_1$ squares in a first row, then $a_2$ squares in a second row (left aligned), and so on until a last row of $a_n$ squares, the you have an upside-down version of the Young diagram for the partition $(a_n,\ldots,a_2,a_1)$. What you are looking for is the number of ways to remove some boxes from the ends of these rows, so that the remainder is still an upside-down Young diagram. The actual question also requires that the first column is entirely retained (since it implicitly discriminates against $0$), but you can obtain that by chopping off the first column from the Young diagram; I will assume this is done so that we are now allowed to remove all boxes from certain rows if we like. Then the number is equal to the number of lattice paths from top-left to bottom right across the Young diagram, staying within its bounds.

The number of such paths is a known number in certain cases. When the Young diagram is a rectangle of sides $k$ and $l$, then the number is the binomial coefficient $\binom{k+l}k$ (our lattice path has $k$ horizontal and $l$ vertical steps, which can be intermixed in any way). If the Young diagram is an equilateral triangle shape with $n$ squares on a side, the number is the Catalan number $C_{n+1}$ (extending the paths with an initial vertical edge and a final horizontal edge, one gets a lattice paths of length $2(n+1)$ staying to one side of a diagonal line, counting of which is one of the interpretations of that Catalan number).