HP Forums
(12C Platinum) GCD & LCM - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (12C Platinum) GCD & LCM (/thread-12174.html)



(12C Platinum) GCD & LCM - Gamo - 01-13-2019 11:05 AM

ALG Mode program solutions for GCD and LCM

----------------------------------------------------

Procedure:

a [R/S] b [R/S] display GCD [R/S] display LCM

Remark:

a and b can be switch around as b and a

---------------------------------------------------
Example:

(256, 562)

256 [R/S] display 256
562 [R/S] display 2 // GCD
[R/S] display 71936 // LCM

Answer:
GCD = 2
LCM = 71936

------------------------------------------------
Program: ALG mode
Code:

[STO] 0 [x] [R/S]
[STO] 1 [=] [STO] 2
[RCL] 0 - [RCL] 1 [=] [STO] 3 
1 [CHS] [X<>Y] [X≤Y] [GTO] 030
[RCL] 3 [CHS] 1 [CHS]  [X<>Y] [X≤Y] [GTO] 034
[RCL] 2 [÷] [RCL] 0 [R/S] [=] [GTO] 000
[RCL] 3 [CHS] [STO] 1 [GTO] 007
[CHS] [STO] 0 [GTO] 007

Gamo