0

How can we determine power of prime $P$ in $C(n,r)$, where $C(n,r)$ denotes the number of combination of $n$ objects taken $r$ at a time. (Also denoted $\binom{n}{r}$ and called a binomial coefficient.)

2 Answers2

3

Denote by $\nu_p \colon \def\N{\mathbf N}\N \to \def\R{\mathbf R}\N$ the $p$-valuation $$ \nu_p(n) := \max\{k \in \N : p^k \mid n \} $$ From counting, we have that $$ \nu_p(n!) = \sum_k \def\fl#1{\left\lfloor #1 \right\rfloor}\fl{\frac n{p^k}} $$ (This is known as Legendre's formula, note that any multiple of $p$ contributes one $p$, any multiple of $p^2$ another $p$ and so on). If we write $n$ in base $p$ digits, that is $$ n = \sum_{i=0}^N d_i(n) p^i, \qquad d_i(n) \in \{0, \ldots, p-1\} $$ we have $$ \fl{\frac n{p^k} } = \sum_{i \ge k} d_i(n) p^{i-k} $$ hence \begin{align*} \nu_p(n!) &= \sum_k \fl{\frac n{p^k}}\\ &= \sum_{k=1}^N \sum_{i= k}^N d_i(n) p^{i-k}\\ &= \sum_{i=1}^N \sum_{k=1}^i d_i(n) p^{i-k}\\ &= \sum_{i=1}^N d_i(n) \cdot \sum_{k=1}^i p^{i-k}\\ &= \sum_{i=1}^N d_i(n) \frac{p^{i} - 1}{p-1}\\ &= \sum_{i=0}^N d_i(n) \frac{p^i - 1}{p-1} \\ &= \frac{n - \sum_{i=0}^N d_i(n)}{p-1} \end{align*} $ $ For brevity, let's denote the digit sum by $s(n) := \sum_{i=0}^N d_i(n)$. We have for the binomial coefficient $\binom nr = {}_n{\mathsf C}_r$ \begin{align*} \nu_p \Biggl(\binom nr\Biggr) &= \nu_p\left(\frac{n!}{r!(n-r)!}\right)\\ &= \nu_p(n!)-\nu_p(r!) - \nu_p\bigl((n-r)!\bigr)\\ &= \frac 1{p-1} \bigl(n - r - (n-r) - s(n) + s(r) + s(n-r)\bigr)\\ &= \frac{s(r) + s(n-r) - s(n)}{p-1} \end{align*}

Ram
  • 1,668
martini
  • 84,101
1

Hint:

You can use Legendre's formula: if you denote $v_P(n)$ the power of $P$ in the prime power decomposition of $n$, one has $$v_P(n!)=\biggl\lfloor\frac np\biggr\rfloor+\biggl\lfloor\frac n{p^2}\biggr\rfloor+\biggl\lfloor\frac n{p^3}\biggr\rfloor+\dots $$ where $\bigl\lfloor x\bigr\rfloor$ denotes the integer part of $x$.

Bernard
  • 175,478