Top "Factorial" questions

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.

Complexity of factorial recursive algorithm

Today in class my teacher wrote on the blackboard this recursive factorial algorithm: int factorial(int n) { if (n == 1) return 1; …

complexity-theory big-o factorial
Print out all permutations of an Array

I am working on a program, and I have a function that swaps the positions in an Array of length …

java arrays algorithm permutation factorial
Example of a factorial time algorithm O( n! )

I'm studying time complexity in school and our main focus seems to be on polynomial time O(n^c) algorithms …

algorithm complexity-theory time-complexity factorial
How do I find a factorial?

How can I write a program to find the factorial of any natural number?

algorithm math language-agnostic factorial
Prolog factorial recursion

I'm having trouble understanding the following factorial program fact1(0,Result) :- Result is 1. fact1(N,Result) :- N > 0, N1 …

recursion prolog factorial
How can I calculate a factorial in C# using a library call?

I need to calculate the factorial of numbers up to around 100! in order to determine if a series of coin …

c# factorial
Built-in factorial function in Haskell

I know this sounds like a stupid question, but here it is: Is there a built-in factorial in Haskell? Google …

haskell factorial
Fast algorithms for computing the factorial

I found this page describing a number of algorithms for computing the factorial. Unfortunately, the explanations are terse and I …

algorithm performance factorial
Basic recursive method - factorial

I am practicing recursion and I can't see why this method does not seem to work. Any ideas? public void …

java recursion factorial
Fast way to calculate n! mod m where m is prime?

I was curious if there was a good way to do this. My current code is something like: def factorialMod(…

algorithm math factorial modulus