Post Reply 
(12C) Greatest Common Divisor
01-26-2022, 07:35 AM
Post: #5
RE: (12C) Greatest Common Divisor
Long time no update this one is nothing special since program used

Euclidean algorithm. Program use four storage registers so that it can

find the LCM as well. With this algorithm I think its run much faster than

the shorter program line version.

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

Example Usage. Find GCD and LCM of 337744, 2736

337744 [R/S] 2736 [R/S] display shown running then 304 [R/S] 3039696

GCD = 304
LCM = 3039696
---------------------------------------------------------
Program:
Quote:01 STO 1
02 R/S
03 STO 2
04 x
05 STO 0
06 RCL 1
07 RCL 2
08 ÷
09 INTG
10 RCL 2
11 x
12 RCL 1
13 -
14 CHS
15 STO 3
16 X=0
17 GTO 23
18 RCL 2
19 STO 1
20 RCL 3
21 STO 2
22 GTO 06
23 RCL 2
24 R/S
25 RCL 0
26 X<>Y
27 ÷
28 GTO 00

Remark:
This program is based on Euclidean algorithm so it run as that so this will not
be about shorter program line, no storage register in use and
using only stacks manipulations.

Gamo 1/26/2022
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(12C) Greatest Common Divisor - Gamo - 01-06-2018, 12:29 AM
RE: (12C) Greatest Common Divisor - Carsen - 01-06-2018, 01:10 AM
RE: (12C) Greatest Common Divisor - Gamo - 01-06-2018, 04:23 AM
RE: (12C) Greatest Common Divisor - Gamo - 10-08-2021, 08:08 AM
RE: (12C) Greatest Common Divisor - Gamo - 01-26-2022 07:35 AM



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