Post Reply 
(33C) (33E) C(y,x), P(y,x) and x!
05-07-2018, 08:46 PM (This post was last modified: 05-07-2018 08:47 PM by Dieter.)
Post: #2
RE: (33C) (33E) C(y,x), P(y,x) and x!
(05-07-2018 06:36 PM)Rogier Wrote:  The 33E was (is) my first programmable calculator. Limited in capacity compared to most other HP-programmables, but you can still fit quite a lot in 49 steps + jumps and subroutines.
HP supplies solutions programs for C(y,x) and P(y,x), but these are bulky. This program calculates C(y,x), P(y,x) and x! in 43 lines.

USE:
y ENTER x R/S > C(y,x) X<=>Y P(y,x)
0 ENTER x R/S > x!

Ah, permutations and combinations – a true classic on programmable calculators without these functions. That's why this topic has been discussed here several times. I'd like to invite you to this thread from last year. These are programs for the 12C, a calculator which is even more limited than the 33E/C. For instance it does not feature subroutines.

The first programs posted there required the factorial function. Then an iterative approach similar to yours was implemented, for instance in post#22 (my attempt at this topic). This version does it in 23 steps. There also is a "deluxe version" with some optimizations (e.g. by minimizing the number of loops due to C(n,k) = C(n,n–k).

No, there is no special factorial function, but you can get this as well by entering n ENTER 1–n. For instance 5 ENTER –4 returns 120. #-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(33C) (33E) C(y,x), P(y,x) and x! - Rogier - 05-07-2018, 06:36 PM
RE: (33C) (33E) C(y,x), P(y,x) and x! - Dieter - 05-07-2018 08:46 PM



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