Post Reply 
(EL-5030) Prime Factors
04-21-2022, 03:01 PM
Post: #1
(EL-5030) Prime Factors
I got one of these odd little programmable Sharp calculators recently, and worked out how to do the typical mod-30 factor finder with its somewhat-limited "AER" (Algebraic Expression Reserve) programming language.

Notable limitations of AER as seen on this model:

- No arbitrary GOTO, only a looping structure resembling nested WHILE loops.
- IF/THEN/ELSE structure, but no loops allowed inside the THEN/ELSE clauses.
- Can do subroutines, but the subroutines can't contain any loops or conditionals.
- Only comparison operators are >, >=, and <> (not equal). To do other comparisons, swap the order of the arguments, or swap your THEN/ELSE bodies.

It does have arrays with indirect addressing, and that's enough to make this workable.

To run this, use the TITLE key to call up the factor program, press COMP, input a number to factor, and press COMP. The program will stop and display the first factor; press COMP to continue finding additional factors. The last factor will be displayed as a negative number.

Some translation notes, because AER uses a lot of symbols that aren't necessarily present in all fonts:

#1 : Reverse-video numbers (subroutines, e.g. 2ndF+Alpha+1)
=> : STO
\-> : Loop start (2ndF 0)
<-\ : Loop end (2ndF .)
<> : Not equal (2ndF 6)
=Y=>[, =N=>[ : THEN and ELSE clauses (2ndF 1, 2ndF 2)
/ : Division
Note that the last step should be negative X (unary minus, not subtraction).

This page has a nice history of Sharp's AER programming system:

http://www.arithmomuseum.com/szamologep....25&lang=en

I couldn't find a manual for the EL-5030 anywhere, but the EL-9000 manual is sufficient. The EL-5030 is largely equivalent to the AER I mode of the EL-9000.

Program code has been heavily broken up and indented for clarity, but this should be entered into the calculator without any spacing.

Code:
Main Body

M:f(X)=
#1
\->
    \->
        C+A[L]=>C
        \->
            X<>INT (X/C)*C
            =N=>[
                C,
                X/C=>X
                <-\
            ]
        L-1=>L
        L>0
        =Y=>[
            <-\
        ]
    X>C*C
    =Y=>[
        8=>L
        <-\
    ]
DIM A[1]
-X

Subroutine 1

#1:DIM A[12]
2=>A[12]
1=>A[11]
2=>A[10]
2=>A[9]
4=>A[8]
2=>A[7]
4=>A[6]
2=>A[5]
4=>A[4]
6=>A[3]
2=>A[2]
6=>A[1]
12=>L
0=>C
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(EL-5030) Prime Factors - Dave Britten - 04-21-2022 03:01 PM
RE: (EL-5030) Prime Factors - Jlouis - 04-22-2022, 02:02 AM
RE: (EL-5030) Prime Factors - Dave Britten - 04-22-2022, 04:27 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-23-2022, 04:27 AM
RE: (EL-5030) Prime Factors - C.Ret - 04-22-2022, 06:48 PM
RE: (EL-5030) Prime Factors - Dave Britten - 04-22-2022, 07:02 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-22-2022, 08:07 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-23-2022, 05:07 PM



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