3

A child is arranging rocks in layers. He can arrange the rocks, in such way that, any layer has lesser rocks than its base layer. Given n rocks, In how many ways can the child arrange the rocks?

Jyrki Lahtonen
  • 140,891
john fedric
  • 103
  • 1
  • 5
  • It sounds like each layer must have strictly less than the preceding layer. Is this correct? You could think of using the stars and bars solution with the proper transformation to handle your constraint. – Ross Millikan Jan 05 '14 at 06:19
  • yes sir each layer has strictly less number of rocks than the preceding layer.. – john fedric Jan 05 '14 at 06:22
  • Are the $n$ rocks distinct? Do you count the different permutations of the $n$ rocks? – peterwhy Jan 05 '14 at 06:28
  • @mathlove, Here i need that the kth layer must have lesser number of rocks than (k-1)th layer.. – john fedric Jan 05 '14 at 06:37
  • @user2132128: Yes, I know it. I hope my answer helps. – mathlove Jan 05 '14 at 06:41
  • @peterwhy, there are n rocks for example if n=7 then the possible arrangements will be 7, 6|1 , 5|2 , 4|3 , 4|2|1 i.e total 5 arrangements if n=7. – john fedric Jan 05 '14 at 06:43
  • @mathlove,could you please elaborate in the context of this problem – john fedric Jan 05 '14 at 06:52
  • @user2132128: Since I think you get the number in the case of $n=7$, let us consider this case. As you wrote, $7$ has $5$ different ways. You can see that each sum is $7$, of course. This means that you question is the same as to find the number of partitions of $n$ with distinct parts. Once you get them, then, you can arrange them from larger number to smaller number from the bottom. – mathlove Jan 05 '14 at 06:57
  • @mathlove , thank you.. – john fedric Jan 05 '14 at 07:06
  • @user2132128: You are welcome! – mathlove Jan 05 '14 at 07:06

3 Answers3

2

What you want is the number of partitions of a given number $n$ with distinct parts. see OEIS.

You can find a lot of information there. You may be interested in restricted partitions.

P.S. The number of partitions of $n$ into distinct parts equals the number of partitions of $n$ into odd parts. see here.

mathlove
  • 151,597
2

Not a close form formula, but I am thinking of solving in this way:

Let $f(n,m)$ be the number of ways $n$ rocks can be arranged (before considering permutations), with the extra constraint that the bottommost layer has $m$ rocks. There is exactly one way to arrange $0$ rocks with $0$ rocks on the bottom, so $f(0,0) = 1$. And there is no way to arrange $0$ rocks with $m>0$ rocks on the bottom, so $f(0,m) = 0$ for $m>0$.

Consider the sum $1+2+3 + \cdots + m = \frac{m(m+1)}2$. $m$ is the minimum number of rocks on the base layer for $\frac{m(m+1)}2$ total number of rocks. So for $n$ total number of rocks, the minimum number of rocks on the base layer is

$$\begin{align*} \frac{m(m+1)}2 \ge& n\\ m \ge& \left\lceil\frac{\sqrt{8n+1}-1}2\right\rceil \end{align*}$$ call the minimum number of base rocks for $n$ rocks be $g(n) = \left\lceil\frac{\sqrt{8n+1}-1}2\right\rceil$

From this, a recursion can be formed: $$f(n,m) = \sum_{i=g(n-m)}^{\max(m-1,n-m)}f(n-m,i)$$

And the required answer for the number of ways to arrange $n$ rocks (without considering permutation) is: $$f(n) = \sum_{m=g(n)}^{n}f(n,m)$$


For the case of $n=7$, $g(7) = 4$. $$\begin{align*} &f(7,4)+f(7,5)+f(7,6)+f(7,7)\\ =&f(3,2)+f(3,3)+f(2,2)+f(1,1)+f(0,0)\\ =&f(1,1)+f(0,0)+f(0,0)+f(0,0)+f(0,0)\\ =& 5 \end{align*}$$

peterwhy
  • 22,930
1

The generating function for the number of arrangements is $$ \begin{align} \prod_{k=1}^\infty\left(1+x^k\right) &=1+x+x^2+2x^3+2x^4+3x^5+4x^6+5x^7+6x^8\\ &+8x^9+10x^{10}+12x^{11}+15x^{12}+18x^{13}+22x^{14}\\[12pt] &+27x^{15}+32x^{16}+38x^{17}+46x^{18}+54x^{19}+64x^{20} \end{align} $$ Each arrangement of $n$ stones contributes $1$ to the coefficient of $x^n$; for example $$ \color{#A0A0A0}{ \left(1+\color{#000000}{x^1}\right) \left(1+\color{#000000}{x^2}\right) \left(\color{#000000}{1}+x^3\right) \left(1+\color{#000000}{x^4}\right) \left(\color{#000000}{1}+x^5\right) \left(\color{#000000}{1}+x^6\right) \left(\color{#000000}{1}+x^7\right) \cdots}\\ \color{#A0A0A0}{ \left(1+\color{#000000}{x^1}\right) \left(\color{#000000}{1}+x^2\right) \left(\color{#000000}{1}+x^3\right) \left(\color{#000000}{1}+x^4\right) \left(\color{#000000}{1}+x^5\right) \left(1+\color{#000000}{x^6}\right) \left(\color{#000000}{1}+x^7\right) \cdots}\\ \color{#A0A0A0}{ \left(\color{#000000}{1}+x^1\right) \left(1+\color{#000000}{x^2}\right) \left(\color{#000000}{1}+x^3\right) \left(\color{#000000}{1}+x^4\right) \left(1+\color{#000000}{x^5}\right) \left(\color{#000000}{1}+x^6\right) \left(\color{#000000}{1}+x^7\right) \cdots}\\ \color{#A0A0A0}{ \left(\color{#000000}{1}+x^1\right) \left(\color{#000000}{1}+x^2\right) \left(1+\color{#000000}{x^3}\right) \left(1+\color{#000000}{x^4}\right) \left(\color{#000000}{1}+x^5\right) \left(\color{#000000}{1}+x^6\right) \left(\color{#000000}{1}+x^7\right) \cdots}\\ \color{#A0A0A0}{ \left(\color{#000000}{1}+x^1\right) \left(\color{#000000}{1}+x^2\right) \left(\color{#000000}{1}+x^3\right) \left(\color{#000000}{1}+x^4\right) \left(\color{#000000}{1}+x^5\right) \left(\color{#000000}{1}+x^6\right) \left(1+\color{#000000}{x^7}\right) \cdots}\\ $$ are all the terms contributing to $x^7$.

robjohn
  • 353,833