Post Reply 
(12C Platinum) Combination Permutation
12-03-2018, 06:05 AM (This post was last modified: 12-03-2018 06:20 AM by Gamo.)
Post: #1
(12C Platinum) Combination Permutation
This program is from HP 12C Platinum Solutions Handbook.

To solve for Combination and Permutation the "Flags"
is use instead of manually go to [GTO] xxx
to go to specific program line.

Enter 0 to calculate Combination
Enter 1 to calculate Permutation

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

Procedure:

0 [R/S] display 0 // for Combination

m [=] n [R/S] display Answer for Combination
----------------------------------------------------
1 [R/S] display 1 // for Permutation

m [=] n [R/S] display Answer for Permutation
----------------------------------------------------

Example:

5C3

0 [R/S] display 0 // calculate Combination

5 [=] 3 [R/S] display 10

-----------------------------------------------
11P4

1 [R/S] display 1 // calculate Permutation

11 [=] 4 [R/S] display 7920
-----------------------------------------------

Program: Combination Permutation (ALG Mode)
Code:

X=0
GTO 016
1
R/S
LSTx
-
X<>Y
=
X<>Y
n!
÷
X<>Y
n!
=
GTO 000
0
R/S
LSTx
-
X<>Y
=
X<>Y
n!
÷
X<>Y
n!
÷
LSTx
n!
=

Gamo
Find all posts by this user
Quote this message in a reply
01-26-2019, 12:57 PM (This post was last modified: 01-26-2019 01:00 PM by Gamo.)
Post: #2
RE: (12C Platinum) Combination Permutation
ALG program solution version II

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

**Permutations: x P y

Procedure:

y [=] x [R/S] display answer

Example: 14 P 5

5 [=] 14 [R/S] display 240,240.00

Program: ALG mode
Code:

[-] [X<>Y] [=] [n!] [÷] [X<>Y] [n!] [=] [1/x]
----------------------------------------
**Combinations: x C y

Procedure:

y [=] x [R/S] display answer

Example: 14 C 5

5 [=] 14 [R/S] display 2002.00

Program: ALG Mode
Code:

[-] [X<>Y] [=] [n!] [x] [LSTx] [n!] [=] [÷] [X<>Y] [n!] [=] [1/x]

Gamo
Find all posts by this user
Quote this message in a reply
04-19-2019, 08:41 AM
Post: #3
RE: (12C Platinum) Combination Permutation
Combinations and Permutation Version III
ALG mode program:

Program code is from HP-12C Platinum Solutions Handbook.

With this program both Combination and Permutation are combine into one program and the fist answer is Combination follow by Permutation.

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

Procedure:

m [ENTER] n [R/S] display C [R/S] display P

--------------------------------------------------
Example: FIX 0

11C5 and 11P5

11 [ENTER] 5 [R/S] 462 [R/S] 55440

Answer: C=462 and P=55440
-------------------------------------------------
Program: ALG mode
Code:

006// [LSTx] [-] [X<>Y] [=] [X<>Y] [n!]
014// [÷] [X<>Y] [n!] [÷] [LSTx] [n!] [=] [R/S]
023// [R↓] [R↓] [=] [LSTx] [=] [LSTx] [-] [X<>Y] [=]
030// [X<>Y] [n!] [÷] [X<>Y] [n!] [=] [GTO 000]

Gamo
Find all posts by this user
Quote this message in a reply
01-14-2020, 07:18 AM (This post was last modified: 01-15-2020 06:18 AM by Gamo.)
Post: #4
RE: (12C Platinum) Combination Permutation
Combinations and Permutation Version IV
Program on RPN mode

mCn for Combination
mPn for Permutation

Where m can be larger than 69

For Permutation, n must be larger than 1 if user input n = 1
result will be wrong answers otherwise assumeing that if it is
mP1 then the answer is m

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

Procedure: RPN mode FIX 0

Combination: Strat at begining of program: [GTO] 000 or [PRGM]

mCn

m [ENTER] n [R/S] ---> Answer

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

Permutation: Goto Line [GTO] 036

mPn

m [R/S] n [R/S] ---> Answer

---------------------------------------
Example: FIX 0

150C5

[PGRM] or [GTO] 000

150 [ENTER] 5 [R/S] display 591,600,030.
--------------------------------------
80P5

[GTO] 036

80 [R/S] display 80
5 [R/S] display 2,884,801,920.
---------------------------------------
For faster speed on Permutation of m < 70

[GTO] 075

m [R/S] n [R/S] ---> Answer
--------------------------------------
Program: RPN mode
Code:

001  -
002 LSTx
003 X≤Y
004 GTO 032
005 STO 0
006  1
007 STO 1
008  +
009 STO 2
010 CLx
011 X≤Y
012 GTO 014
013 GTO 034
014 Rv
015  1
016 RCL 1
017  +
018 STO 1
019 X≤Y
020 GTO 023
021 RCL 2
022 GTO 000
023 RCL 0
024 X<>Y
025  +
026 LSTx
027  ÷
028 RCL 2
029  x
030 STO 2
031 GTO 014
032 X<>Y
033 GTO 005
034  1
035 GTO 000  // End routine of Combination
--------------------
036 ENTER
037 STO 0
038 R/S
039 X≤Y
040 GTO 042
041 GTO 071
042 X≤Y
043 GTO 046
044  0
045  ÷
046  1
047 X≤Y
048 GTO 050
049 GTO 068
050 CLx
051 X≤Y
052 GTO 054
053 GTO 073
054  +
055  -
056  1
057  +
058  x
059 LSTx
060 RCL 0
061  1
062  -
063 X≤Y
064 GTO 068
065 GTO 066
066 Rv
067 GTO 056
068 Rv
069 Rv
070 GTO 000
071 n!
072 GTO 000
073  1
074 GTO 000  // End routine of Permutation
-------------------
075 ENTER
076 n!
077 X<>Y
078 R/S
079  -
080 n!
081  ÷ 
082 GTO 000  // End routine of fast Permutation

Gamo 1/2020
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)