3

I am practicing combinatorics problems and came across this problem:

How many sets of 10 distinct positive integers sum to at most 2021?

Here is my approach to get the answer: First, we consider the following: If $$\sum_{i=1}^{10}x_i = n$$ then the number of possible solutions(where order does not matter) is $$\frac{n+9 \choose n}{10!}$$.

The minimum $n$ is 55. ($\sum_{i=1}^{10} i$) . The maximum is 2021. Therefore, the total number of solutions is: $$ \sum_{n=55}^{2021}\frac{n+9 \choose n}{10!} $$

Is this correct? If not where is the mistake?

drhab
  • 153,781
  • Your denominator is $10!$ but lots of the solutions $(x_1,\dots,x_n)$ do not consist out $10$ distinct entries. Moreover numerator $\binom{n+9}n$ (stars and bars) corresponds with non-negative $x_i$. In a way the requirement that integers must be distinct makes things more difficult. That is not included in stars and bars. – drhab Nov 01 '22 at 10:38
  • @drhab How would I change th denominator then? Consider that I cannot subtract from a total since the maximum sum is unbound. The numerator on the other hand seems like a simpler fix, which I could implement on my own as well. – Naitik Mundra Nov 01 '22 at 10:43
  • Note: I missed the condition that the integers had to be distinct.That complicates things enormously. – lulu Nov 01 '22 at 10:43
  • I really don't know (yet) how to solve this. As remarked in the comments the fact that the integers must be distinct is the greatest obstacle here. – drhab Nov 01 '22 at 10:46
  • Does this invalidate my entire solution then? Some solutions to numerator do not consist of distinct numbers at all? – Naitik Mundra Nov 01 '22 at 10:47
  • Yes, your solution is invalid. I would automate the computation. – lulu Nov 01 '22 at 10:48
  • 1
    Yes, it does. To get some ideas it might be wise to solve things by brute force for small numbers $n$ and also less integers. But I have not much hope. – drhab Nov 01 '22 at 10:49
  • here is a generalization. I agree with the solution there...set up recursions and then let a machine run through it. Maybe some sort of greedy algorithm works better...not sure about that. – lulu Nov 01 '22 at 10:50
  • 1
    @lulu This is an olympiad problem and is meant to be solved by hand, using some math tricks/identities/properties. I will take a look at it for inspiration though. – Naitik Mundra Nov 01 '22 at 10:57
  • 1
    Can you provide a link to the relevant Olympiad? I find it hard to believe there is an easy method. Anything is possible of course, but this sort of partition problem is well known and I've never seen a useful closed form solution. – lulu Nov 01 '22 at 11:03
  • @lulu https://drive.google.com/file/d/1KihWP9yJFIJMVPu3J4Dbt-S4rxDa-t1M/view Question 3 – Naitik Mundra Nov 01 '22 at 11:24
  • Note that no attribution is provided, in particular there is no claim that it came from an actual olympiad. I didn't look at all those questions but the first of them is very simple...my guess is that whoever set these problems made an error. Happy to be proven wrong...I'd love to see an easy way to count things like this. – lulu Nov 01 '22 at 11:34
  • @lulu this is from https://sites.google.com/site/imocanada/2021-summer-camp, and is referenced by couple of other sites as well, eg: https://mathematical.olympiad.ch/de/training. So I would say, this is legit. – Naitik Mundra Nov 01 '22 at 11:37
  • 1
    In case it helps here is a solution for the equality only. – Fabius Wiesner Nov 01 '22 at 17:45
  • @BillyJoe Note how your question contains similar objects compared to the distinct integers here. Of course, in both cases, the groups/sets are indistinguishable. – Naitik Mundra Nov 01 '22 at 21:08

1 Answers1

5

Supposing that we want $k$ distinct integers that sum to at most $n$ we first choose the minimum value

$$\frac{z}{1-z}$$

and then we choose $k-1$ differences between consecutive values

$$\left(\frac{z}{1-z}\right)^{k-1}.$$

The coefficient $[z^n]$ of the product

$$F(z) = \left(\frac{z}{1-z}\right)^k$$

then gives the number of sets of $k$ distinct positive integers with the largest element being $n.$ We want the sum however. Now the minimum value contributes $k$ times, the first difference $k-1$ and so on, the last difference contributes once.

This gives the product

$$G(z) = \prod_{q=0}^{k-1} \frac{z^{k-q}}{1-z^{k-q}} = \prod_{q=1}^k \frac{z^q}{1-z^q}.$$

This coefficient gives the set of $k$ distinct positive integers that sum to exactly $n.$ If we require at most $n$, we sum by multiplying by $1/(1-z)$ and obtain

$$H(z) = \frac{1}{1-z} \prod_{q=1}^k \frac{z^q}{1-z^q}$$

We may write

$$H(z) = \frac{z^{\frac{1}{2} k(k+1)}}{1-z} \prod_{q=1}^k \frac{1}{1-z^q} = z^{\frac{1}{2} k(k+1)} J(z)$$

so that

$$J(z) = \frac{1}{1-z} \prod_{q=1}^k \frac{1}{1-z^q} \quad\text{and}\quad H_{n,k} = J_{n-\frac{1}{2} k(k+1), k}.$$

The base case here is $H_{n,k} = 0$ if $n\lt \frac{1}{2} k(k+1)$ and $H_{\frac{1}{2} k(k+1), k} = 1.$

Differentiate to get

$$J'(z) = \frac{1}{1-z} \prod_{q=1}^k \frac{1}{1-z^q} \left[ \frac{1}{1-z} + \frac{1}{z} \sum_{q=1}^k \frac{q z^q}{1-z^q}\right].$$

Extract coefficients on $[z^{n-1}]$ to get

$$n J_{n,k} = \sum_{p=0}^{n-1} J_{p,k} + \sum_{q=1}^k q \sum_{p=1}^{\lfloor n/q \rfloor} J_{n-pq,k}.$$

We find the recurrence

$$\bbox[5px,border:2px solid #00A000]{ J_{n,k} = \frac{1}{n} \left[ \sum_{p=0}^{n-1} J_{p,k} + \sum_{q=1}^k q \sum_{p=1}^{\lfloor n/q \rfloor} J_{n-pq,k}\right]}$$

where $n\ge 1$ and $J_{0,k} = 1.$

We implement this as a memoized recurrence in our favorite CAS and obtain for the pair $(n,k) = (2021, 10)$

$$\bbox[5px,border:2px solid #00A000]{ H_{2021, 10} = 75434038103498084111.}$$

Seeing that we are in the eleventh month of the year $2022$ we also find

$$\bbox[5px,border:2px solid #00A000]{ H_{2022, 11} = 1212319110727843596031.}$$

Reply to comments, some time later. It was asked why we differentiate. Well if we have an equation for a generating function it defines the coefficients being the same on the LHS and the RHS. So that does not tell us about the relation between the coefficients. If we then differentiate however we obtain some type of relation between coefficients that often leads to a recurrence. So that's why. It was also asked why we extract coefficients. The coefficient gives us the desired number of sets that sum to at most $n$ so it is the quantity we are interested in. Finally, how do we extract coefficients, we get for example

$$[z^{n-1}] \frac{1}{z} \sum_{q=1}^k \frac{q z^q}{1-z^q} J(z) = [z^n] \sum_{q=1}^k \frac{q z^q}{1-z^q} J(z) \\ = [z^n] \sum_{q=1}^k q (z^q + z^{2q} + z^{3q} + \cdots) J(z) \\ = [z^n] \sum_{q=1}^k q (z^q + z^{2q} + z^{3q} + \cdots + z^{\lfloor n/q\rfloor q}) J(z) \\ = \sum_{q=1}^k q [z^n] \sum_{p=1}^{\lfloor n/q \rfloor} z^{pq} J(z) \\ = \sum_{q=1}^k q \sum_{p=1}^{\lfloor n/q \rfloor} [z^{n-pq}] J(z) = \sum_{q=1}^k q \sum_{p=1}^{\lfloor n/q \rfloor} J_{n-pq, k}.$$

Marko Riedel
  • 64,728
  • Thanks! Brilliant Answer. However, I was only able to follow till you defining $J(z)$, why you did anything after(especally the differentiation) is a mystery to me. Also, could you explan the notation on the LHS in the derived Formula? ($J_{n,k}$) – Naitik Mundra Nov 05 '22 at 08:33
  • 1
    I have also reached by different means a solution defined by recurrence - I haven't checked yet if it is the same as yours. However Olympiad math problems usually have a "Aha moment", which gets a solution that is computable by hand. So we should still look for a closed form... – Jean-Armand Moroni Nov 05 '22 at 13:13
  • @Jean-ArmandMoroni, what is your solution? About being computable by hand, some problems i have seen were just left in notation form.. (for eg calculating $20!/4!$) – Naitik Mundra Nov 05 '22 at 14:13
  • 1
    Apparently http://oeis.org/A288345, but with an offset of $55$ because we need distinct integers, i.e. the term for $n=1966=(2021-55)$ in that sequence is the answer here. – nickgard Nov 05 '22 at 15:53
  • @nickgard the 55 can be explained because 1+2+...10=55, i.e. the minimum is 55. The formula(1 / ((1-x)^2(1-x^2)(1-x^3)...(1-x^10))), however, is a little bit more tricky. Any explanation? I have a couple of ideas and I will try to flesh it out and post if I come up with anything. – Naitik Mundra Nov 05 '22 at 17:34
  • @MarkoRiedel: Very nice approach and good elaboration. (+1) – Markus Scheuer Nov 05 '22 at 18:40
  • 1
    @epi163sqrt Thanks for the kind words. – Marko Riedel Nov 05 '22 at 19:00
  • @NaitikMundra I can't claim to explain it. I used a Python program to do a brute force calculation of the first few terms then did an OEIS search. I hoped it might be useful to others. – nickgard Nov 06 '22 at 08:31
  • @MarkoRiedel Why did you differentiate? And why extract the coeffiecients and how? – Naitik Mundra Nov 06 '22 at 09:52
  • @NaitikMundra I have added some comments, – Marko Riedel Nov 06 '22 at 19:46
  • @MarkoRiedel Thanks. – Naitik Mundra Nov 07 '22 at 06:00