Combination with Repetition Calculator
Compute combinations with repetition C(n+r-1, r) from type and pick counts.
📐 计算公式
可重复组合:C(n+r−1,r)=(n+r−1)!÷(r!·(n−1)!);对照不重复组合 C(n,r)=n!÷(r!(n−r)!),n 小于 r 时记 0。校验:n、r 必须是非负整数且各自 ≤10000;n≥1,r=0 合法。主式与对比 C(n,r) 均用 BigInt 精确整数计算,不做四舍五入或封顶。
输入类型数 n 与选取数 r,求可重复组合数。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Combinations with repetition | Choosing r items from n types with repetition gives C(n + r - 1, r) | Feller W., An Introduction to Probability Theory and Its Applications, Vol. 1, Wiley |
| Stars and bars | Equivalent to placing r identical balls into n boxes, giving C(n + r - 1, r) | Feller W., An Introduction to Probability Theory and Its Applications, Vol. 1 |
| Versus combinations without repetition | Without repetition the count is C(n, r), and C(n, r) <= C(n + r - 1, r) | Brualdi RA, Introductory Combinatorics (5th ed.) |
| Typical use | Used for recipes, allocations and multiset counting where items may repeat | Feller W., An Introduction to Probability Theory and Its Applications, Vol. 1 |
📌 计算说明
- 星棒法经典计数。
- n=5,r=3 → 35。