Skip to content

Instantly share code, notes, and snippets.

@musoftware
Created February 21, 2014 12:26
Show Gist options
  • Save musoftware/9133393 to your computer and use it in GitHub Desktop.
Save musoftware/9133393 to your computer and use it in GitHub Desktop.
Combinatoric selections
using System;
using System.Collections.Generic;
using System.Text;
namespace eular_53
{
class Program
{
static void Main(string[] args)
{
long exeedsmilliom = 0;
for (int n = 1; n <= 100; n++)
for (int r = 1; r <= 100; r++)
if (C(n, r) > 1000000) exeedsmilliom++;
Console.WriteLine(exeedsmilliom);
Console.ReadKey();
}
static public double multiplexer(int num)
{
double tmp = 1;
for (int c = 1; c <= num; c++)
tmp *= c;
return tmp;
}
static public double C(int n, int r)
{
return multiplexer(n) / (multiplexer(r) * multiplexer(n - r));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment