public double cdfUp(double p, int k, int n) {
		if (k < 0) return 1.0;
		if (k >= n) return 0;

		double cdf = 0;
		// Sum smaller numbers first
		for (int i = n; i > k; i--)
			cdf += pdf(p, i, n);

		cdf = Math.min(1.0, cdf);
		return cdf;
	}