Number of bags of a given length with exactly d distinct elements 0 ▲ ℤ→ℤ 96 days ago · 9 min read1816 words · Tech · hide · Fediverse post We develop a formula for counting the number of bags of length \(l\) containing \(d\) distinct elements drawn from \(t\) objects. The formula involves multiplication of combinations without replacement and combinations with replacement. We present alternative forms of the formula and a generator in Python. Our motivation was computing probabilities of various types of card hands, such as how many hands of size 5 contain exactly two suites. Introduction In games, a matching mechanic may be used to restrict a player’s choice to options that match a previous play. Trick-taking games, a popular and specialized subset of matching, often restrict a player to “follow” a previous play’s cards suites or colors. In computer science, a function may assign items to specific buckets (e.g. a hash function) and we are concerned with the spread and number of collisions with a bucket. For analyzing both types of problems we likely desire to count the total number of variations possible. In our case,… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town