public class LogFact2 { // Notkun: x = logFact(N) // Fyrir: N >= 0 // Eftir: x = log(N!) public static double logFact(int N) { double s = 0.0; for (int i = 1; i <= N; i++) { s += Math.log(i); } return s; } }