Let n > 0 be an integer. We are given a balance and n weights of weight 2^0, 2^1, ... ,2^(n−1). In a sequence of n moves we place all weights on the balance. In the first move we choose a weight and put it on the left pan. In each of the following moves we choose one of the remaining weights and we add it either to the left or to the right pan. Compute the number of ways in which we can perform these n moves in such a way that the right pan is never heavier than the left pan. ------------------ Observation: i-th weight is bigger that all the previous weights combined. Therefore, what pan si hevier depends only on the heaviest weight on the balance: If the heavies weight on the balance is on the left pan, the left pan is heavier, if the heavies weight on the balance is on the right pan, the right pan is heavier, So we are simply never allowed to put a weight on the right pan which is heavier than the heaviest weight on the left pan. Let's try 3, weights: 0,1,2 (their powers of 2) If we first put the weight 2 to the left, we can do anything then, 8 options Other options: 1L 0R 2L 1L 0L 2L 1L 2L 0R 1L 2L 0L 0L 2L 1R 0L 2L 1L 0L 1L 2L Actually, whenewer we take a weight smaller than what is already on the balance, it is irrelevant where we put it. So the options can be written as 2L 0* 1* (4) 2L 1* 0* (4) 1L 2L 0* (2) 1L 0* 2L (2) 0L 2L 1* (2) 0L 1L 2L (1) 15 options So, for every ordering of weights, there is a power of two options how to put the weights on the balance in that order. Try n=2 0L 1L (1) 1L 0* (2) 3 options Could it be a subset of triangle numbers? 1 (3) 6 10 (15) It seems unlikely. What about power of two minus 1? 2^2-1, 2^4-1, 2^(2n-2)-1? For n=1, there is just one option: 1L it does not fit to the pattern but it could be an exception. Should I try n=4? I am lazy, the problem should be easy... maybe later. Could I split the options according to someting else than the permutation of weights? Or, could I produce a sequence of moves based on a subset of (2n-2)? In the case of n=1, n=2, a half of the cases starts with the biggest weight. But this is not the general case, for n=4, the number of ways starting with the weight 3 is 2^3*3! Actually, 2^(n-1)*(n-1)! will eventually exceed 2^(2n-2), so the number of options cannot be 2^(2n-2)-1 What about using recursion, if I have already calculated the number of ways for a given n, can I calculate the number of ways for n+1? I can produce any new way by putting the biggest weight to the left in the end. Or anywhere else, but it does not cover all the options with n+1 steps. Other approach: Take a sequence of adding weights (1..n), and add 0 to it. I can add the weight 0 to any place of the process, and either to the left, or to the right. Reversely, by removing a weight 0 from the process, I get a valid sequence of weights for (1..n), which correspond to (0..n-1) Well, except the first right position. So if A_n represents the number of ways for putting weights to the balance for a given n, we have A_n = (2n-1)*A_(n-1) Check: Does it fit the data? * A_1 = 1 * A_2 = 1*3 = 3 * A_3 = 1*3*5 = 15 * yes, it works. In a closed form, it can be written as (1*...*2n) / (2*4*..(2n)) = (2n)! / (2^n * n!)