Post Reply 
Elektronika MK-61/52 & B3-34/MK-54 - Prime Factor Decomposition (P.Henrici)
07-12-2019, 03:39 PM (This post was last modified: 07-16-2019 11:23 AM by rwsh76.)
Post: #1
Elektronika MK-61/52 & B3-34/MK-54 - Prime Factor Decomposition (P.Henrici)
From : Computational Analysis with the HP 25 Pocket Calculator
By : Peter Henrici
©1977 by John Wiley & Sons, Inc.
Last update : July 16th 2019, 13:22 CEST (minor correction on listing #2 step 19 : ИП7)

Hereafter, a conversion of the first example, "Prime Factor Decomposition", as shown in pages 9 to 13 (listing in p.14) of P. Henrici's book.

When program is keyed in and operating mode switched to ABT (AUTo), type the number (m) to decompose and press B/0 to set current program step to 00, then C/П (R/S) to start.

"The calculation will start, then stop by displaying smallest prime factor of m. When R/S is pressed, the next prime factor will be displayed, and so forth, until 0 is shown, indicating that all prime factor have been found."

MK-61/52 :
00
01 40 Х→П0 STO 0
02 02 2
03 42 Х→П2 STO 2
04 01 1
05 43 Х→П3 STO 3
06 60 П0→Х RCL 0
07 21
08 41 Х→П1 STO 1
09 61 П1→Х RCL 1
10 62 П2→Х RCL 2
11 11 -
12 59 Х⋝0
13 51 51 if Х<0 GTO 51 (52-1)
14 60 П0→Х RCL 0
15 62 П2→Х RCL 2
16 13 ÷
17 35 {Х} FP
18 57 Х≠0
19 44 44 if Х=0 GTO 44 (45-1)
20 62 П2→Х RCL 2
21 04 4
22 11 -
23 5c Х<0 appears as 5C on the display
24 32 32 if Х⋝0 GTO 32 (33-1)
25 62 П2→Х RCL 2
26 02 2
27 12 ×
28 01 1
29 11 -
30 42 Х→П2 STO 2
31 51 БП GTO
32 08 08 08 (09-1)
33 62 П2→Х RCL 2
34 03 3
35 10 +
36 42 Х→П2 STO 2
37 63 П3→Х RCL 3
38 0b /-/ CHS - appears as 0L on the display
39 43 Х→П3 STO 3
40 62 П2→Х RCL 2
41 10 +
42 42 Х→П2 STO 2
43 51 БП GTO
44 08 08 08 (09-1)
45 60 П0→Х RCL 0
46 62 П2→Х RCL 2
47 50 C/П R/S
48 13 ÷
49 40 Х→П0 STO 0
50 51 БП GTO
51 06 06 06 (07-1)
52 60 П0→Х RCL 0
53 50 C/П R/S
54 00 0
55 50 C/П R/S
56 51 БП GTO
57 53 53 53 (54-1)


B3-34/MK-54 :
00
01 40 П0/Х→П0 STO 0
02 02 2
03 42 П2/Х→П2 STO 2
04 01 1
05 43 П3/Х→П3 STO 3
06 60 ИП0/П0→Х RCL 0
07 21
08 41 П1/Х→П1 STO 1
09 61 ИП1/П1→Х RCL 1
10 62 ИП2/П2→Х RCL 2
11 11 -
12 59 Х⋝0
13 56 56 if Х<0 GTO 56 (57-1)
14 60 ИП0/П0→Х RCL 0
15 62 ИП2/П2→Х RCL 2
16 13 ÷
17 46 П6/Х→П6 STO 6
18 47 П7/Х→П7 STO 7
19 d7 K ИП7/П7→Х RCL [7] - Used to force conversion of register 7's content to integer - appears as Г7 on the display
20 66 ИП6/П6→Х RCL 6
21 67 ИП7/П7→Х RCL 7
22 11 -
23 57 Х≠0
24 49 49 if Х=0 GTO 49 (50-1)
25 62 ИП2/П2→Х RCL 2
26 04 4
27 11 -
28 5c Х<0 appears as 5C on the display
29 37 37 if Х⋝0 GTO 37 (38-1)
30 62 ИП2/П2→Х RCL 2
31 02 2
32 12 ×
33 01 1
34 11 -
35 42 П2/Х→П2 STO 2
36 51 БП GTO
37 08 08 08 (09-1)
38 62 ИП2/П2→Х RCL 2
39 03 3
40 10 +
41 42 П2/Х→П2 STO 2
42 63 ИП3/П3→Х RCL 3
43 0b /-/ CHS - appears as 0L on the display
44 43 П3/Х→П3 STO 3
45 62 ИП2/П2→Х RCL 2
46 10 +
47 42 П2/Х→П2 STO 2
48 51 БП GTO
49 08 08 08 (09-1)
50 60 ИП0/П0→Х RCL 0
51 62 ИП2/П2→Х RCL 2
52 50 C/П R/S
53 13 ÷
54 40 П0/Х→П0 STO 0
55 51 БП GTO
56 06 06 06 (07-1)
57 60 ИП0/П0→Х RCL 0
58 50 C/П R/S
59 00 0
60 50 C/П R/S
61 51 БП GTO
62 58 58 58 (59-1)

И П Х Б З Н Г ↑ → √ ⋜ ⋝ ≠ × ÷

RPN calcs worshipper - Hewlett-Packard/Elektronika
AOS/alg. calcs explorer/BASIC pocket computers liker-lover
Find all posts by this user
Quote this message in a reply
Post Reply 




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