Post Reply 
Example Program to calculate Factorial
02-04-2018, 02:52 AM
Post: #36
RE: Example Program to calculate Factorial
(02-02-2018 08:28 AM)Dieter Wrote:  
(02-02-2018 02:44 AM)Gene Wrote:  For historical purposes and ideas...

Here is factorial from V2N10P11 of PPC Journal:

01 STO 0
02 GTO 05
03 -
04 ST0 x 0
05 1
06 X<Y
07 GTO 03
08 X=Y
09 RCL 00
10 GTO 00 (or R/S)

That's a nice one.

How about this 9-step one?

Code:

01   1
02   STO 0
03   STO* 0
04   1
05   +
06   x<=y
07   GTO 03
08   RCL 00
09   GTO 00

However, for practical purposes I would insert two Rv instructions after GTO 03:

Code:

...
07   GTO 03
08   Rv
09   Rv
10   RCL 0
11   GTO 00

Example:

Compute C(15, 4)

15 R/S 4 R/S / 15 ENTER 4 - R/S / -> 1365

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


Messages In This Thread
RE: Example Program to calculate Factorial - Gerson W. Barbosa - 02-04-2018 02:52 AM



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