import java.math.BigInteger; public class prob53 { public static double ncr (int n, int r) { BigInteger top = fact(n); BigInteger rf = fact(r); BigInteger nmrf = fact(n - r); return (top.divide(rf.multiply(nmrf))).doubleValue(); } public static BigInteger fact (int n) { int j; BigInteger res = new BigInteger("1"); for (j = n; j > 1; j--) { res = res.multiply(new BigInteger("" + j)); } return res; } public static void main(String args[]) { int r, n, tot; tot = 0; for (n = 1; n <= 100; n++) { for (r = 1; r <= 100; r++) { if (ncr(n,r) > 1000000) { tot++; } } } System.out.println("Total: " + tot); } }