Created
November 1, 2025 13:12
-
-
Save juanfal/b653f8340fbb29adc0dcf3d7c20e1a35 to your computer and use it in GitHub Desktop.
binomial numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // binomial.cpp | |
| // juanfc 2025-11-01 | |
| // | |
| #include <iostream> | |
| using namespace std; | |
| typedef long long unsigned TLong; | |
| int main() | |
| { | |
| TLong binomial(unsigned, unsigned); | |
| for (unsigned i = 10; i < 40; ++i) | |
| cout << binomial(i, 10) << " "; | |
| cout << endl; | |
| return 0; | |
| } | |
| TLong binomial(unsigned n, unsigned m) | |
| { | |
| TLong f; | |
| if (m == 0 or n == m) | |
| return 1; | |
| else if (n == 0) | |
| return 0; | |
| else | |
| return binomial(n, m-1) * (n-m+1)/m; | |
| return f; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment