Home · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z · Numbers & Symbols

The Compleat User RPL Encyclopedia


FACT (Factorial)

x    x!
Keyboard Access:
     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/50 has 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/50 finds 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.1
Real inputs, however, are very fast:
  7.000! - 0.031 sec
253.119! - 0.086 sec
253.120! - Overflow
(Timings done on an HP49. The HP49G+/50G is faster than the 49G.)

HP49/50 maximum integer input: 9999 (result has 35656 digits; takes over 3 hours on the HP49G); 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