public class LogFact { // Notkun: x = logFact(N) // Fyrir: N >= 0 // Eftir: x = log(N!) public static double logFact(int N) { if (N == 0) { return 0.0; } return Math.log(N) + logFact(N-1); } }