## FACT (Factorial)

Keyboard Access: x x!HP-28: REAL HP48/49/50: 2050.17 MENU... but don't; use ! instead.Factorial function, prefix notation.Definition: FACT(n) = n! = n(n-1)(n-2)(n-3)...(3)(2)(1)

Example: 5! = 5×4×3×2×1 = 120

Note: Although the gamma function can be calculated using factorials by the relation (n-1)! = GAMMA(n), the

HP49/50has a built-in GAMMA function that handles complex inputs (unlike the factorial function) and simplifies to exact symbolic answers when possible (unlike !).A postfix-notation version of FACT is available, called !. 'X!' is functionally identical to 'FACT(X)'.

HP49/50finds exact answers for any integer, but large inputs take a long time to calculate:250! - 0:02.5 (2.5 seconds) 500! - 0:12.4 750! - 0:31.7 1000! - 1:01.2 2000! - 4:55.1Real inputs, however, are very fast:7.000! - 0.031 sec 253.119! - 0.086 sec 253.120! - Overflow(Timings done on anHP49. TheHP49G+/50Gis faster than the49G.)

HP49/50maximum integer input: 9999 (result has 35656 digits; takes over 3 hours on theHP49G); any integer above this generates the "Integer too large" error. If exact factorials larger than this are needed (?), then obtain the ExtraFunc49+ library from www.hpcalc.org. It calculates 9999! exactly in 1 minute, and has no input limit.BYTES: 2.5