For n identical candies shared among k distinct children, with zero allowed and no caps, the number of distributions is binomial(n + k − 1, k − 1). This stars-and-bars formula counts allocation patterns directly. If every child must get candy or some children have minimums or maximums, adjust the model before calculating; those conditions change what counts as valid.
Define what counts as a distribution
Let xi be the number of candies received by child i. If all candies must be distributed, the total is described by x1 + x2 + ··· + xk = n.
The basic formula applies when candies are identical, children are distinct, each child may receive zero, and there are no capacity limits. For example, “Alice gets 3, Ben gets 4, and Cy gets 3” is a different distribution from “Alice gets 4, Ben gets 3, and Cy gets 3,” because the recipients are named.
- Identical candies: only the number each child receives matters; individual candy identities do not.
- Distinct children: changing which child gets a given amount creates a different allocation.
- All candies distributed: the amounts sum to n.
- Zero allowed: a child may receive nothing unless the question sets a minimum.
- No caps: there is no upper limit on any child’s amount.
If candies are individually distinguishable, children are interchangeable, or some candies may remain undistributed, this is a different counting model; the formulas below do not apply unchanged.
#1 Best Overall
- Rich chocolate variety in every bag – Each pack is stuffed with 2 pounds of individually wrapped fun size chocolate bars, peanut butter cups, wafer bars, caramel chocolate and almond chocolate treats that every chocolate lover will enjoy
- Perfect for any summer occasion – Great for backyard barbecues, pool parties, road trips, office chocolate bowls, gift baskets, and satisfying everyday chocolate cravings at home
- Every piece individually wrapped – Each treat comes sealed in its own wrapper keeping everything fresh and making sharing easy and mess free for everyone
- Incredible bulk value – 2 pounds of premium assorted chocolate packed tight so there is always more than enough for the whole crowd
- The ultimate chocolate gift – Decadent rich and satisfying this chocolate variety pack makes the perfect addition to any gift bag, care package, or sweet surprise for someone special
Count unrestricted distributions with stars and bars
For nonnegative integer solutions to x1 + ··· + xk = n, the count is:
C(n + k − 1, k − 1)
Imagine writing one star for each candy and inserting k − 1 dividers to separate the children’s shares. For three children, for instance, a pattern such as **|***|* represents 2 candies, 3 candies, and 1 candy. Adjacent dividers or a divider at an end represent an empty share. There are n stars and k − 1 dividers, so each arrangement occupies n + k − 1 positions; choosing which positions contain dividers gives the formula. Each pattern corresponds to exactly one allocation vector, so the method counts distributions without listing them one by one. Richard Hammack presents the same representation in Book of Proof.
Example: 10 identical candies for 3 children, with zero allowed
Here n = 10 and k = 3, so the count is C(10 + 3 − 1, 3 − 1) = C(12, 2) = 66. This is the worked result in Xiaohui Xie’s stars-and-bars notes.
Rank #2
- Contains one (1) 37.05-Ounce 18-count variety mix box of SKITTLES and STARBURST Candy
- This variety pack features SKITTLES Original, Sour, and Wild Berry flavors and STARBURST Original and FaveREDS flavors
- Give everyone's favorite SKITTLES and STARBURST Candy flavors for care package ideas and hostess gifts
- Perfect for parties, Easter, Christmas, Valentine's Day and Halloween or as a midday treat
- Stock the office pantry with a variety mix box of SKITTLES and STARBURST Candy
Example: 10 identical candies for 4 children, with zero allowed
The count is C(10 + 4 − 1, 4 − 1) = C(13, 3) = 286, the result shown in Fall 2025 combinatorics course notes.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Require every child to receive at least one
For a positive share by every child, first give each child one candy. That uses k candies and leaves n − k to distribute freely. If n ≥ k, the number of allocations is:
C(n − 1, k − 1)
If n < k, no valid distribution exists because there are not enough candies to give one to each child.
Rank #3
- Stress Free Party Prep; ready to pour and serve assortment; quick fill for goodie bags, pinatas, and treat bowls; ideal for busy hosts and classroom organizers
- Cleaner Sharing Anywhere; individually wrapped pieces for grab and go convenience; cleaner candy service for classrooms, offices, and events; easy handouts with less mess
- Fun Size Variety Everyone Reaches For; gummies, taffy chews, hard candies, and lollipops; mix of textures and flavors so more people find a favorite; keeps bowls and buffets interesting
- Approx. 100 Pieces In 2 Pounds; dependable coverage for parties and busy weeks; fewer refills for candy jars, reception bowls, and reward bins; simple to store between events
- Made For Holiday Moments; stocking stuffer filler, parade throws, trick or treat handouts, birthdays, and school celebrations; easy to set on dessert tables and favor stations; a simple win for any gathering
Example: 10 identical candies for 3 children, at least one each
Reserve 1 candy for each child, leaving 7. The remaining nonnegative allocation count is C(7 + 3 − 1, 3 − 1) = C(9, 2) = 36, matching Xie’s worked example.
Handle different minimums by shifting the variables
If child i must receive at least ai candies, write xi = ai + yi, where each yi is nonnegative. The amount left to allocate is n − Σai. When that remainder is nonnegative, count the allocations as:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchC(n − Σai + k − 1, k − 1)
When n is less than the sum of the minimums, there are no valid allocations. For example, if two children must receive at least 1 and 2 candies, respectively, from a total of 5, reserve 3 candies first. The remaining 2 can be split nonnegatively between the two, giving C(2 + 2 − 1, 2 − 1) = 3 possibilities. This shifting approach is also illustrated in the Fall 2025 course notes.
Rank #4
- Diverse Candy Selection: Our Assorted Candy Variety Pack boasts a wide array of flavors and textures, from fruity to sour and everything in between, ensuring a delightful experience for every candy enthusiast. Please note: As this item is an assortement the candy shown in this picture may differ slightly to what you are receiving, you may not receive all the candy types shown in the image.
- Individually Wrapped Convenience: Each candy in this assortment is thoughtfully individually wrapped, guaranteeing freshness and making it easy to share, gift, or enjoy on-the-go without any hassle.
- Perfect for Any Occasion: Whether it's a birthday, office party, baby shower, or casual get-together, this Candy Assortment is designed to elevate any event and add a touch of sweetness to every moment.
- 32-Ounce Size: With 32 ounces of candy in each pack, you'll have an abundance of treats to go around, ensuring that no one misses out on the joy of indulging in their favorite flavors.
- Vibrant and Colorful Presentation: The candies come in a captivating array of colors, wrapped in vibrant packaging that not only preserves their freshness but also adds a festive touch to your candy display or party buffet.
Apply inclusion-exclusion when children have caps
The unrestricted formula includes allocations that exceed a child’s capacity. To impose upper bounds, start with the unrestricted count and remove allocations that violate one or more caps using inclusion-exclusion. For a child with cap m, a violation means xi ≥ m + 1. In a set of violations, subtract m + 1 from that child’s amount, and count the remaining nonnegative solutions. For different caps, use each child’s own threshold.
For a set S of children assumed to exceed their caps, the shifted total is n − Σi∈S(mi + 1). If that total is nonnegative, the number of allocations in that intersection is C(n − Σi∈S(mi + 1) + k − 1, k − 1); otherwise it is zero. Subtract the counts for single violations, add back pairwise intersections, subtract triple intersections, and continue with alternating signs. This corrects for allocations counted in more than one violation set.
Xie’s notes illustrate the method with ordered triples totaling 15 under caps of 5, 6, and 7, obtaining 10 after inclusion-exclusion. That is a bounded-composition example, not a result for a candy setup unless those exact totals and caps are used.
Recommended Free Tools
Choose the right model before calculating
| Question to settle | Model or consequence |
|---|---|
| Are the candies identical or individually distinguishable? | Stars and bars counts only identical items by recipient totals. Distinguishable candies require a different count. |
| Are children distinct or interchangeable? | The formulas here treat children as distinct categories; swapping their amounts can produce a different allocation. |
| May a child receive zero? | Use nonnegative solutions if yes; use the positive-allocation formula if every child needs at least one. |
| Are there minimums? | Reserve each required minimum, then distribute what remains. |
| Are there caps? | Correct the unrestricted count for over-cap allocations, for example with inclusion-exclusion. |
| Must every candy be distributed? | The equation assumes the shares sum to the full candy total. |
Keep the wording of the question attached to the result: “10 identical candies to 3 distinct children, zero allowed” has 66 distributions, while requiring at least one per child gives 36. Without a specified candy total, number of children, and conditions on valid shares, there is no single numerical answer.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




