It strikes me that negative factorials are possible, you just have to define them just as positive factorials are defined. If you choose that a negative factorial counts up to 0. Then you get..

Code:
Break ON

For $ = -8 to 8
""+$+"! = "+f($) ?
Next

Get $

Function f($)

$f = 1
For $i = IIf($>0,1,$) to IIf($>0,$,~)
$f=CDbl($f)*$i

EndFunction



output

Code:
-8! = 40320
-7! = -5040
-6! = 720
-5! = -120
-4! = 24
-3! = -6
-2! = 2
-1! = -1
0! = 1
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
6! = 720
7! = 5040
8! = 40320



Edited by It_took_my_meds (2006-09-28 03:55 AM)