public double pdfLog(double p, int k, int n) {
		if ((k < 0) || (k > n)) return 0;
		if (k == n) return k * Math.log(p);
		return sumLog(n) - (sumLog(k) + sumLog(n - k)) + k * Math.log(p) + (n - k) * Math.log(1 - p);
	}