Post Reply 
Little problem(s) July 2022
07-10-2022, 10:37 PM (This post was last modified: 07-11-2022 04:23 AM by Didier Lachieze.)
Post: #29
RE: Little problem(s) July 2022
Here is a solution to #1 on the Texas SR-52, the first programmable calculator with indirect register addressing back in 1975. It includes the list input.

Usage: 0 STO 99 then input each list element followed by [ A ], when finished input number N and press [ B ], after some time the program will return the index of the first element, press [RUN] to get the second element. You can then input another value for N and press [ B ] without having to input the list again. If there is no solution it returns 0 and 1.

Example: 0 [STO] 99 2 [A] 7 [A] 11 [A] 15 [A] 17 [ B ] returns 1 and 4 then 18 [ B] returns 2 and 3

Performance: On my SR-52 with upgraded memory it can handle lists up to 49 elements (vs. 19 on a regular SR-52).
With the list {1,2,3...48,49} searching for 3 returns 1 and 2 in 14 minutes. This is the worst case as the loops with dsz are done starting from the last element and going down.

Code:
Texas SR-52: 73  steps
Note: it uses the same notation as in the SR-52 manual:
* for the 2nd key and ' for the numeric labels (1', 2', 3')

//List input
000 46 11         *LBL A
002 65            x
003 01 44 09 09   1 SUM 99
007 95            =
008 36 42 09 09   *IND STO 99
012 56            *rtn

//Search
013 46 12         *LBL B
015 42 06 08      STO 68   
018 43 09 09      RCL 99
021 42 00 00      STO 00

024 46 87         *LBL *1’
026 43 00 00      RCL 00    
029 42 06 09      STO 69    
032 58 88         *dsz *2’
034 41 89         GTO *3’

036 46 88         *LBL *2’
038 43 06 08      RCL  68
041 75            -
042 36 43 06 09   *IND RCL 69
046 75            -
047 36 43 00 00   *IND RCL 00
051 95            =
052 90 89         *if zro *3’
054 58 88         *dsz *2’

056 43 06 09      RCL 69
059 42 00 00      STO 00
062 58 87         *dsz *1’

064 46 89         *LBL *3’
066 43 00 00      RCL 00
069 81            HLT
070 43 06 09      RCL 69
073 56            *rtn
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Little problem(s) July 2022 - pier4r - 07-04-2022, 06:04 PM
RE: Little problem(s) July 2022 - pauln - 07-05-2022, 01:01 AM
RE: Little problem(s) July 2022 - pier4r - 07-05-2022, 10:00 AM
RE: Little problem(s) July 2022 - pier4r - 07-05-2022, 01:56 PM
RE: Little problem(s) July 2022 - pier4r - 07-07-2022, 10:51 AM
RE: Little problem(s) July 2022 - DavidM - 07-07-2022, 12:02 PM
RE: Little problem(s) July 2022 - DavidM - 07-07-2022, 03:09 PM
RE: Little problem(s) July 2022 - pier4r - 07-07-2022, 05:19 PM
RE: Little problem(s) July 2022 - Werner - 07-06-2022, 07:48 AM
RE: Little problem(s) July 2022 - DavidM - 07-07-2022, 05:27 PM
RE: Little problem(s) July 2022 - pier4r - 07-07-2022, 05:37 PM
RE: Little problem(s) July 2022 - Didier Lachieze - 07-10-2022 10:37 PM
RE: Little problem(s) July 2022 - pauln - 07-11-2022, 05:34 AM
RE: Little problem(s) July 2022 - pauln - 07-11-2022, 10:32 PM



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