Method 1: GCF Algorithm
min #larr# smaller number
max #larr# larger number
rem #larr# remainder of integer division: max #div# min
while rem #!= 0#
#color(white)("XX")#max#larr#min
#color(white)("XX")#min#larr#rem
#color(white)("XX")#rem #larr# remainder of integer division: max #div# min
end_while
GCF#larr#min
#color(white)("XX")#Application with 28 and 42
min #larr# 28
max #larr# 42
rem #larr# 14 (since #42div28=2R14#)
since #14 != 0# do the "while"
#color(white)("XX")#max#larr#28
#color(white)("XX")#min#larr#14
#color(white)("XX")#rem#larr#0 (since #28div14=2R0#)
loop back to re-test loop condition
since #0=0# continue with instructions following the while loop
GCF#larr#14
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Method 2: Collecting Common Prime Factors
Factoring #28#
#color(white)("XX")28=2xx14=2xx2xx7#
Factoring #42#
#color(white)("XX")42=2xx21=2xx3xx7#
Extract common prime factors:
#GCF(cancel(2)xx2xx7,cancel(2)xx3xx7)#
#color(white)("XX")=2xxGCF(2xxcancel(7),3xxcancel(7))#
#color(white)("XX")=2xx7xxGCF(2,3)#
#color(white)("XX")=2xx7xx1#
#color(white)("XX")=14#