Greatest Common Devisor, Least Common Multiple, Fraction Finder

Description

This program computes the greatest common divisor and the least common multiple of two integers. It can also find the numerator and denominator of a fraction to approximate a real number.

Press the A key to compute the Greatest Common Divisor (GCD) of two values in the X and Y registers. Press the B key to compute the Least Common Multiple (LCM) of the two values in the X and Y registers. The C key is used to compute the integer numerator and denominator of a fraction that approximates a real number in the X register. There are two modes of operation Automatic Mode and Manual Mode. Press the E key to toggle Automatic mode On/Off (After pressing E, a 1 shown in the X register indicates that Automatic Mode is on, while a 0 shown in the X register indicates that Automatic Mode is off.

Examples:
etc.

Program Resources

Labels

Name Description Name Description
 A Compute the GCD of X and Y  2 Internal Use
 B Compute the LCM of X and Y  5 Internal Use
 C Find Fractionn to approximate X  6 Internal Use
 D Show last Fraction  7 Internal Use
 E Toggle Automatic Mode On/Off  8 Internal Use
 0 Internal Use  9 Internal Use
 1 Internal Use 10 Internal Use

Storage Registers

Name Description
 1 Internal Use
 2 Internal Use
 3 Numerator of Fraction
 4 Denominator of Fraction
 5 Original Real Number
 9 Internal Use
I Internal Use

Flags

Number Description
0 Internal Use
1 Internal Use

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 064 43 20 g x=0 128 45 2 RCL 2
001 42.21.11 f LBL A 065 43 32 g RTN 129 40 +
002 44 2 STO 2 066 42.21. 8 f LBL 8 130 45 4 RCL 4
003 34 x↔y 067 32 ,0 GSB . 0 131 44 2 STO 2
004 44 1 STO 1 068 43.30. 0 g TEST x≠0 132 33 R⬇
005 1 1 069 22 8 GTO 8 133 44 4 STO 4
006 44 3 STO 3 070 45 3 RCL 3 134 43. 6. 1 g F? 1
007 43 35 g CLx 071 45 1 RCL 1 135 32 5 GSB 5
008 44 4 STO 4 072 10 ÷ 136 45 3 RCL 3
009 43.30. 5 g TEST x=y 073 43 16 g ABS 137 34 x↔y
010 22 0 GTO 0 074 43 32 g RTN 138 10 ÷
011 44 3 STO 3 075 42.21. ,0 f LBL . 0 139 42. 7. 9 f FIX 9
012 44 5 STO 5 076 45 1 RCL 1 140 43. 6. 1 g F? 1
013 1 1 077 45 1 RCL 1 141 32 5 GSB 5
014 44 4 STO 4 078 45 2 RCL 2 142 45 5 RCL 5
015 44 25 STO I 079 44 1 STO 1 143 30
016 42.21. 9 f LBL 9 080 10 ÷ 144 43 20 g x=0
017 32 ,0 GSB . 0 081 43 44 g INT 145 32 6 GSB 6
018 43 20 g x=0 082 16 CHS 146 43 20 g x=0
019 22 0 GTO 0 083 44 9 STO 9 147 43 32 g RTN
020 45 25 RCL I 084 45 2 RCL 2 148 42. 8. 9 f SCI 9
021 45 3 RCL 3 085 20 × 149 43. 6. 1 g F? 1
022 44 25 STO I 086 40 + 150 32 5 GSB 5
023 45 9 RCL 9 087 44 2 STO 2 151 43. 6. 1 g F? 1
024 20 × 088 43 32 g RTN 152 32 6 GSB 6
025 40 + 089 42.21.13 f LBL C 153 33 R⬇
026 44 3 STO 3 090 0 0 154 43. 4. 1 g SF 1
027 45 5 RCL 5 091 44 1 STO 1 155 22 7 GTO 7
028 45 4 RCL 4 092 44 4 STO 4 156 42.21.14 f LBL D
029 44 5 STO 5 093 33 R⬇ 157 42. 7. 0 f FIX 0
030 45 9 RCL 9 094 36 ENTER 158 45 3 RCL 3
031 20 × 095 44 5 STO 5 159 32 5 GSB 5
032 40 + 096 1 1 160 45 4 RCL 4
033 44 4 STO 4 097 44 2 STO 2 161 32 5 GSB 5
034 22 9 GTO 9 098 44 3 STO 3 162 10 ÷
035 42.21. 0 f LBL 0 099 43. 4. 1 g SF 1 163 42. 7. 9 f FIX 9
036 45 1 RCL 1 100 42.21. 7 f LBL 7 164 32 5 GSB 5
037 43.30. 1 g TEST x>0 101 42. 7. 0 f FIX 0 165 32 6 GSB 6
038 22 1 GTO 1 102 10 ÷ 166 45 5 RCL 5
039 43 35 g CLx 103 43 36 g LSTx 167 30
040 45 4 RCL 4 104 36 ENTER 168 43 32 g RTN
041 16 CHS 105 33 R⬇ 169 42.21. 5 f LBL 5
042 45 3 RCL 3 106 34 x↔y 170 43. 6. 0 g F? 0
043 16 CHS 107 43 44 g INT 171 42 31 f PSE
044 45 1 RCL 1 108 44 25 STO I 172 43. 6. 0 g F? 0
045 16 CHS 109 20 × 173 43 32 g RTN
046 22 2 GTO 2 110 30 174 31 R/S
047 42.21. 1 f LBL 1 111 45 25 RCL I 175 43 32 g RTN
048 43 35 g CLx 112 45 3 RCL 3 176 42.21. 6 f LBL 6
049 45 4 RCL 4 113 20 × 177 43. 6. 0 g F? 0
050 45 3 RCL 3 114 45 1 RCL 1 178 42 31 f PSE
051 45 1 RCL 1 115 40 + 179 43 32 g RTN
052 42.21. 2 f LBL 2 116 43 20 g x=0 180 42.21.15 f LBL E
053 31 R/S 117 43. 5. 1 g CF 1 181 43. 6. 0 g F? 0
054 33 R⬇ 118 45 3 RCL 3 182 22 0 GTO 0
055 31 R/S 119 44 1 STO 1 183 43. 4. 0 g SF 0
056 33 R⬇ 120 33 R⬇ 184 1 1
057 31 R/S 121 44 3 STO 3 185 43 32 g RTN
058 42.21.12 f LBL B 122 43. 6. 1 g F? 1 186 42.21. 0 f LBL 0
059 44 2 STO 2 123 32 5 GSB 5 187 43. 5. 0 g CF 0
060 34 x↔y 124 43 35 g CLx 188 0 0
061 44 1 STO 1 125 45 25 RCL I 189 43 32 g RTN
062 20 × 126 45 4 RCL 4
063 44 3 STO 3 127 20 ×