Post Reply 
Example Program to calculate Factorial
02-08-2018, 08:04 PM (This post was last modified: 02-08-2018 10:06 PM by Gene.)
Post: #37
RE: Example Program to calculate Factorial
Slightly OT, but wanted to put this into the factorial thread. Source: A TI SR-56 brochure printed in England.

Factorial for the SR-56. Takes 14 steps out of 100. Thats' an interesting efficiency aspect vs. the HP 25, etc. versions.

Code:
LRN             (places calculator in program mode)
00  STO
01  0           (stores n into memory 0 - dsz always works on memory 0)
02  2nd CP   (clear's the T-register)
03  x=t?      (Tests if zero entered for n?)
04  1
05  2           (if so, transfers to location 12 to display 1 as answer)
06  RCL       (if not, continues here)
07  0           (Recalls N and starts the multiplication loop)
08  x 
09  dsz        (As long as memory 0 is > 0, loops back to step 06)
10  0
11  6
12  1           (when memory 0 is equal to zero, multiplies computed value by 1)
13  =          ( then finishes computation and stops execution)
14  R/S
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Example Program to calculate Factorial - Gene - 02-08-2018 08:04 PM



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