The Museum of HP Calculators


Permutation for the HP-25

This program is Copyright © 1975 by Hewlett-Packard and is used here by permission. This program was originally published in "HP-25 Applications Programs".

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

A permutation is an ordered subset of a set of distinct objects. The number of possible permutations, each containing n objects, that can be formed from a collection of m distinct objects is given by

                 m!
         mPn = ------- = m(m-1) ... (m-n+1)
               (m-n)!

where m, n are integers and 0 < = n <= m.

Notes:

1. mPn can also be denoted by Pmn,  P(m,n) or (m)n.

2. mP0 = 1,   mP1 = m,   mPm = m!

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter program

     

2

Store m, n

m

STO 0

 

 

 

n

STO 1

 

3

Compute permutations

  

f PRGM R/S

mPn

4

For new case, go to step 2

 

 

 

Examples

1. 43P3 = 74046.00
2. 73P4 = 26122320.00

The Program

LINE    CODE    KEYS
 00  
 01     24 00   RCL 0
 02     24 00   RCL 0
 03     24 01   RCL 1
 04     15 71   g x=0
 05     13 29   GTO 29
 06     14 71   f x=y
 07     13 31   GTO 31
 08     14 51   f x>=y
 09     13 39   GTO 39
 10        01   1
 11     14 71   f x=y
 12     13 41   GTO 41
 13        22   roll dn
 14        41   -
 15        01   1
 16        51   +
 17        61   x
 18     14 73   f LASTx
 19     24 00   RCL 0
 20        01   1
 21        41   -
 22     14 71   f x=y
 23     13 26   GTO 26
 24        22   roll dn
 25     13 15   GTO 15
 26        22   roll dn
 27        22   roll dn
 28     13 00   GTO 00
 29        01   1
 30     13 00   GTO 00
 31        01   1
 32        41   -
 33     15 71   g x=0
 34     13 37   GTO 37
 35  23 61 00   STO x 0
 36     13 31   GTO 31
 37     24 00   RCL 0
 38     13 00   GTO 00
 39        00   0
 40        71   ÷
 41        22   roll dn
 42        22   roll dn
 43     13 00   GTO 00

Register Use

R0  m
R1  n

Go back to the software library
Go back to the main exhibit hall