Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binomial coefficient from previous related coefficient #1015

Open
jxu opened this issue Jan 15, 2023 · 5 comments
Open

Binomial coefficient from previous related coefficient #1015

jxu opened this issue Jan 15, 2023 · 5 comments

Comments

@jxu
Copy link
Contributor

jxu commented Jan 15, 2023

Are the following useful enough for loops? This is what I did for project euler problems when asked to compute (n choose i) mod large prime over loop index i before I noticed factorials could be precomputed. This is most similar to the "factoring in" rule.

$$\binom{k}{i} = \frac{k-i+1}{i} \binom{k}{i-1}$$

$$\binom{k}{i+1} = \frac{k-i}{i+1} \binom{k}{i}$$

$$\binom{k-i}{i} = \frac{(k-2i+2)(k-2i+1)}{i(k-i+1)} \binom{k-(i-1)}{i-1}$$ WA

etc.

@adamant-pwn
Copy link
Member

Useful in what sense? I don't see any immediate usage over e.g. precomputed factorials?

@jxu
Copy link
Contributor Author

jxu commented Jan 26, 2023

Perhaps useful for some math problems, but I don't know any specific uses.

@jakobkogler
Copy link
Member

It might make sense to notice the first formula.
It does indeed can be useful, if you try to find a closed formula for a combinatorics problem on paper.

But the second formula ist just the same formula as the first one (by replacing i-> i+1).
The third one looks interesting, but that one seems to be very rarely useful.

@jxu
Copy link
Contributor Author

jxu commented Jan 26, 2023

There are more identities listed in Ch 5 of Concrete Mathematics. "Factoring in" is called "Absorption"

image

@jxu
Copy link
Contributor Author

jxu commented Feb 2, 2023

Also should "Freshman's Dream" be mentioned for binomial coefficients? https://en.wikipedia.org/wiki/Freshman%27s_dream
$$(x+y)^p = x^p + y^p $$
in field Z/pZ[x], that is polynomials with coefficients mod p.

due to divisibility of $p \choose n$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants