4

I'm trying to compute the number of $t$-tuples such that no element appears exactly once in the tuple, and each element can take values from $[N]=\left\{0,\ldots,N-1\right\}$. Let us denote $u_{N, t}$ this quantity. For instance, for $t=4$ and $N=128$, $(1, 4, 1, 4)$ is a valid tuple (each element within the tuple has at least one other copy) but $(1, 4, 1, 1)$ is not ($4$ is alone). It is fairly simple to see that:

  • $u(N, 1)=0$, since every tuple will contain a single element, it can't have any other copies of it
  • $u(N, 2)=N$, since every valid tuple can be written as $(x, x)$, with $x\in[N]$
  • $u(N, 3)=N$, since every valid tuple can be written as $(x, x, x)$

My reasoning for the general case is the following:

  • $u_{N, t}$ is equal to $N^t$ minus the number of tuples such that at least one element is unique.
  • For $k\geqslant1$, we thus choose the positions of the unique elements, for which we have $\binom{t}{k}$ choices
  • We have to choose the values for these elements, for which we have $\frac{N!}{(N-k)!}$ choices.
  • We finally have to choose the values for the other $N-k$ elements. We know that they cannot contain a single unique element, thus we have $u_{N-k,t-k}$ choices.

All in all, we have: $$u_{N, t}=N^t-\sum_{k=1}^t\binom{t}{k}\frac{N!}{(N-k)!}u_{N-k, t-k}$$ However:

  • I'm not sure this formula is correct: for $t=1$ and $t=2$ there are some corner cases that make it most likely wrong (we don't get $0$ and $N$ respectively), but it might work for $t\geqslant3$
  • For large values of $N$, this can be quite tedious to compute (dynamic programming?)
  • I would especially be interested in a closed-form for $u_{N, t}$ (or at least some asymptotic behavior for $t=o(N)$)

Is there any clever way to compute this quantity that I missed?

RobPratt
  • 45,619
  • These are $t$-tuples. A combination is an unordered selection of distinct elements. – joriki Mar 27 '23 at 11:25
  • I removed the [tag:combinations] tag and added the [tag:coupon-collector] tag, as you're essentially asking for the probability to complete a collection that contains at least $2$ of each of $N$ types of coupons in $t$ draws. For the slightly simpler problem of completing a collection that contains each type at least once, see this question. – joriki Mar 27 '23 at 11:29
  • You could treat this with inclusion–exclusion, but the fact that you have two ways of violating each condition (by having either no item or only one item) is probably going to lead to a more complicated result. – joriki Mar 27 '23 at 11:32
  • I don't understand the approach you're taking. You seem to be completely ignoring the possibility that some values aren't present at all? – joriki Mar 27 '23 at 11:35
  • @joriki I've corrected it. Thanks! Thanks also for the link, I'll take a look at it. Concerning your final remark, I think the problem comes from the way I've written the problem: it doesn't matter if some elements are not present in the tuple. For instance, for $N=128$, the tuple $(1, 4, 1, 4)$ is valid because no element is "single". Does it make my reasoning more sensible? – Tristan Nemoz Mar 27 '23 at 12:23
  • It makes your reasoning more sensible, but it makes the title and introduction rather misleading. It's easy to interpret them (as I did) to mean that each of the elements in $[N]$ needs to appear twice. I've removed the [tag:coupon-collector] tag that I'd added because this problem isn't related to the coupon collector's problem. – joriki Mar 27 '23 at 12:44
  • @joriki Thanks for your answer! What do you think I should change the title to in order to remove the ambiguity, so that the question may be useful to others? – Tristan Nemoz Mar 27 '23 at 13:04
  • 1
    Thanks for thinking about that. How about "such that no element appears exactly once"? – joriki Mar 27 '23 at 13:08
  • 1
    @joriki That's done. Thanks again! – Tristan Nemoz Mar 27 '23 at 13:10

2 Answers2

3

You can do this using inclusion–exclusion.

To violate $k$ of the $t$ conditions that an element of the tuple must not be unique, you can choose the conditions to be violated in $\binom tk$ ways, the unique values in $\frac{N!}{(N-k)!}$ ways and the remaining values in $(N-k)^{t-k}$ ways, so by inclusion–exclusion there are

$$ \sum_{k=0}^t(-1)^k\binom tk\frac{N!}{(N-k)!}(N-k)^{t-k}=\sum_{k=0}^t(-1)^kk!\binom tk\binom Nk(N-k)^{t-k} $$

admissible configurations. Alternatively, you could use the $N$ conditions that the value $k$ must not be used exactly once; the result is of course the same, you just get $\binom Nk\frac{t!}{(t-k)!}$ instead of $\binom tk\frac{N!}{(N-k)!}$.

joriki
  • 238,052
1

Your formula doesn't look bad to me but I obtain a simpler formula by a different reasoning:

  • When $t = 0$ one has $u_{N,t}=1$ because the empty tuple is the only solution.
  • When $N = 0$ and $t \not = 0$, one has $u_{N, t}=0$.
  • When $N\not = 0$ and $t\not = 0$, let $p\in [0, N-1]$ be the largest value in the tuple and let $q\in [0, t-2]$ be the number of slots in the tuple that don't contain the value $p$. There are $\binom{t}{q}$ such sets of slots and $u_{p, q}$ ways to fill the missing slots, hence \begin{equation} u_{N, t} = \sum_{p=0}^{N-1}\sum_{q=0}^{t-2}\binom{t}{q} u_{p,q} \end{equation}
Gribouillis
  • 14,188