# N! for 6 is 6*5*4*3*2*1 but what is 6.1! ?

1. Sep 8, 2004

### tony873004

I know that n! for 6 is 6*5*4*3*2*1 but what is 6.1! ? My calculator says 868.957. How do they come up with this?

I'm trying to write a computer program that mimics the calculator program that comes with windows.

I know that using my above formula that I have to make an exception for 0!=1, and Invalid Input for Function for a negative number.

Anything else I should know about n! ??

2. Sep 8, 2004

### Tide

The factorial is a special case of the gamma function. The relationship is $x! = \Gamma (x+1)$ and the factorial is usually reserved for nonnegative integers.

3. Sep 8, 2004

### Janitor

This question crops up here every now and then, I have noticed. Here is one website on the relation between the gamma function and factorials.

http://mathworld.wolfram.com/GammaFunction.html

4. Sep 8, 2004

### tony873004

Thanks for your replies. This forum is great!
That link scared me away. I think I might drop the n! button from my calculator since I can't make it do non-integers and the Windows calculator can.

5. Sep 8, 2004

### Tide

Actually, it's not too hard do. You can create a table of values for the gamma function over the interval (0, 1] from which you can obtain values of $\Gamma (x)$ for larger x values using the fact that $\Gamma (x+1) = x \Gamma(x)$. If you want greater accuracy you can write a simple interpolation routine.

6. Sep 9, 2004

### tony873004

But what would I do with the values between 0 & 1? Add them to the integer's factorial, or multiply them (probably not. I'm guessing they'd be less than 1, and 6.1! > 6!). I'm not sure I could trust my interpolation routine. If I could come up with that I could probably forget the table altogether. I could also make the Calculator generate an error message on non-integer inputs. Do people ever use the n! button? I never have.

7. Sep 9, 2004

### Tide

No. You would branch to one of two subroutines - one for integer values and one for noninteger values.