Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created November 1, 2025 13:12
Show Gist options
  • Select an option

  • Save juanfal/b653f8340fbb29adc0dcf3d7c20e1a35 to your computer and use it in GitHub Desktop.

Select an option

Save juanfal/b653f8340fbb29adc0dcf3d7c20e1a35 to your computer and use it in GitHub Desktop.
binomial numbers
// 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