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。