Post Reply 
(11C) GCD and LCM
01-06-2018, 04:34 PM
Post: #2
RE: (11C) Least Common Multiple <> GCD
Here is another version which is generally much faster and operates only in the stack - no registers needed.

On HP11C, 159951 ENTER 2585 returns in approximatively 10 seconds
Y : 11 <- GCD
X : 37588485 <- LCM

Code:
01▸LBL A
02 FIX 2
03 ENTER
04 ENTER
05 R↑
06 ENTER
07 R↓
08 X>Y?
09 X<>Y
10▸LBL 1
11 ÷
12 LASTX
13 X<>Y
14 FRAC
15 X<>Y
16 ×
17 LASTX
18 X<>Y
19 RND
20 X≠0?
21 GTO 1
22 R↓
23 R↓
24 ×
25 R↑
26 ÷
27 R↑
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) GCD and LCM - Gamo - 01-06-2018, 12:59 PM
RE: (11C) Least Common Multiple <> GCD - wawa - 01-06-2018 04:34 PM



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