Combinatoric Selections
How many values of C(n, r) for 1 <= n <= 100 and 0 <= r <= n are greater than one million?
Problem Statement
This archive keeps the full statement, math, and original media on the page.
There are exactly ten ways of selecting three from five, 12345: $$123, 124, 125, 134, 135, 145, 234, 235, 245, \text{ and } 345$$ In combinatorics, we use the notation, $\displaystyle \binom 5 3 = 10$.
In general, $\displaystyle \binom n r = \dfrac{n!}{r!(n-r)!}$, where $r \le n$, $n! = n \times (n-1) \times ... \times 3 \times 2 \times 1$, and $0! = 1$.
It is not until $n = 23$, that a value exceeds one-million: $\displaystyle \binom {23} {10} = 1144066$.
How many, not necessarily distinct, values of $\displaystyle \binom n r$ for $1 \le n \le 100$, are greater than one-million?
Problem 53: Combinatoric Selections
Mathematical Development
Formal Development
Definition 1 (Binomial Coefficient). For non-negative integers ,
Theorem 1 (Unimodality). For fixed , the sequence is strictly unimodal: it strictly increases for and strictly decreases for , achieving its maximum at (and when is even).
Proof. Consider the ratio of consecutive terms:
This ratio satisfies:
- ,
- (only when is odd),
- .
Hence for and for , establishing strict unimodality.
Theorem 2 (Symmetry). For all ,
Proof. Direct from the definition: .
Corollary 1 (Contiguous Exceedance). For any threshold and fixed , the set
is either empty or a contiguous interval with .
Proof. By Theorem 1 (unimodality), defines a connected sublevel set of a unimodal function. By Theorem 2 (symmetry), if , then . The exceedance set is therefore symmetric about and contiguous. If is the smallest element, the largest is , giving cardinality .
Lemma 1 (Pascal’s Recurrence). For :
Proof. Combinatorial argument: among subsets of of size , those containing element number , and those not containing number .
Lemma 2 (Overflow Avoidance via Capping). Define where . Then can be computed using Pascal’s recurrence with capped values:
and if and only if .
Proof. We proceed by induction on . Base case: . Inductive step: if and correctly represent their respective binomial coefficients capped at , then:
- If : both summands are below , so , and .
- If : then either some summand equals (so the sum ) or both are exact but sum to . Either way, .
In both cases, .
Theorem 3 (Counting Formula). The total count of values for is
Editorial
We examine every pair with and , determine the corresponding binomial coefficient, and count those exceeding one million. A practical implementation can either evaluate the coefficients directly or generate them row by row using Pascal’s recurrence with capping to avoid large intermediate values; both approaches enumerate exactly the same set of coefficients and apply the same threshold test.
Pseudocode
Algorithm: Counting Large Binomial Coefficients
Require: The range 1 ≤ n ≤ 100 and the threshold 10^6.
Ensure: The number of binomial coefficients C(n, r) that exceed 10^6.
1: Initialize count ← 0.
2: For each n in {1, 2, ..., 100} do:
3: For each r in {0, 1, ..., n}, compute C(n, r) and test whether it exceeds 10^6.
4: If the test succeeds, increment count.
5: Return count.
Complexity Analysis
Proposition 1 (Time). The algorithm computes Pascal’s triangle row by row. Row has entries, each computed in (values are capped at , fitting in a machine word). Total operations:
For : operations.
Proposition 2 (Space). for storing one row of Pascal’s triangle (at most entries).
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
const int LIMIT = 1000000;
int count = 0;
// Pascal's triangle with capping to prevent overflow
vector<long long> row(102, 0);
row[0] = 1;
for (int n = 1; n <= 100; n++) {
for (int r = n; r >= 1; r--) {
row[r] = row[r] + row[r - 1];
if (row[r] > LIMIT) row[r] = LIMIT + 1;
}
for (int r = 0; r <= n; r++) {
if (row[r] > LIMIT) count++;
}
}
cout << count << endl;
return 0;
}
"""
Problem 53: Combinatoric Selections
How many values of C(n, r) for 1 <= n <= 100 are greater than one million?
"""
from math import comb
def solve():
count = 0
threshold = 1_000_000
for n in range(1, 101):
for r in range(0, n + 1):
if comb(n, r) > threshold:
count += 1
print(count)
solve()