We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Combinatorics
- nCr table
- Discussions
nCr table
nCr table
Sort by
recency
|
119 Discussions
|
Please Login in order to post a comment
great post
An nCr table, also known as a combination table, is a systematic way to list combinations of items, especially useful in probability and statistics. It typically shows the number of ways to choose r items from a set of n items without regard to the order of selection. Such tables are invaluable in fields like combinatorics, where precise calculations of permutations and combinations are required. They serve as quick references, aiding in computations for various scenarios, from binomial coefficients to complex probability distributions. For those interested in exploring practical applications or enhancing their understanding of these concepts, resources like Studio Trataka's Qutub Copper Candle Stand T-Light, available at https://studiotrataka.com/product/qutub-copper-candle-stand-t-light/, can add a touch of elegance to your study environment while you delve into the intricacies of combinatorial mathematics.
Python
math.comb
is so fast that the following brute-force one-liner works:You can watch Raymond Hettinger's amazing talk "Numerical Marvels Inside Python" to understand why
math.comb
is so fast, including with very very largen
(group theory ahead!).def solve(n): ncr = [] for r in range (n//2 + 1): ncr.append(comb(n, r)%(10**9)) if n % 2== 0: return ncr + ncr[:-1][::-1] else: return ncr + ncr[::-1]
My accepted Go solution: