HP Forums
(12C Platinum) Reverse Factorial - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (12C Platinum) Reverse Factorial (/thread-11853.html)



(12C Platinum) Reverse Factorial - Gamo - 11-27-2018 08:29 AM

Just acquired a brand new HP-12C Platinum and here is the first program for it.
This program also work on original HP-12C.

Program is use for reverse factorial.
If you know the number of ways and need to know what is the value of its Factorial.

-----------------------------------------------------

Procedure:

Integer [R/S] display Factorial Integer

If Integer is not a perfect Factorial the answer will display "negative" Factorial integer,
then switch stack display the + or - integer.

Integer [R/S] display Negative Factorial [X<>Y] +or- Integer
Remark: The negative result indicate that this is not a perfect factorial.

----------------------------------------------

Example:

120 is what Factorial?

120 [R/S] display 5

Answer: 5!

-----------------------------------

555 is what Factorial?

555 [R/S] display -5 [X<>Y] 435

Answer: 5! + 435

---------------------------------
Program: Reverse Factorial (RPN Mode)
Code:

001 STO 0
002 STO 1
003  2
004 STO 2
005 RCL 0
006 RCL 2
007  ÷
008 STO 0
009 RCL 2
010 X<>Y
011 X≤Y
012 GTO 016
013  1
014 STO+2
015 GTO 005
016  1
017 RCL 0
018  -
019 X=0
020 GTO 028
021 RCL 1
022 RCL 2
023 n!
024  -
025 RCL 2
026 CHS
027 GTO 000
028 RCL 2

Program for ALG Mode
Code:

001 STO 0
002 STO 1
003  2
004 STO 2
005 RCL 0
006  ÷
007 RCL 2
008  =
009 STO 0
010 RCL 2
011 X<>Y
012 X≤Y
013 GTO 017
014  1
015 STO+2
016 GTO 005
017  1
018  -
019 RCL 0
020  =
021 X=0
022 GTO 031
023 RCL 1
024  -
025 RCL 2
026 n!
027  =
028 RCL 2
029 CHS
030 GTO 000
031 RCL 2

Gamo