Post Reply 
Find LCM of 2 numbers without using GCD
07-31-2018, 01:28 PM (This post was last modified: 07-31-2018 01:42 PM by Gamo.)
Post: #18
RE: Find LCM of 2 numbers without using GCD
Hello Paul Dale

This particular algorithm is one of the several others ways to solve for LCM.
Like Dieter said this algorithm is not meant for speed but is for ways to program this specific algorithm just for fun or this routine might be helpful to use into some program if any.

I just figure this out to write program for this LCM algorithm.
Even though this routine run slow with large integers but give very accurate result. [Slowly but Surely] Smile

I have to break Dieter hearth by using 3 registers on this program. Sorry. Smile

Program: HP-12C : Find LCM of 2 numbers without using GCD
Code:

01 X≤Y ?
02 X<>Y
03 X<>Y
04 STO 1
05 X<>Y
06 STO 2
07 STO 3
08 RCL 3
09 RCL 1
10   ÷
11 FRAC
12 X=0 ?
13 GTO 19
14 RCL 2
15 RCL 3
16   +
17 STO 3
18 GTO 08
19 RCL 3
20 GTO 00

Example:
LCM (105, 321)
105 ENTER 321 [R/S] ---> 11235

LCM (10553, 7133)
10553 ENTER 7133 [R/S] ---> 75274549

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Find LCM of 2 numbers without using GCD - Gamo - 07-31-2018 01:28 PM



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