ScratchData LogoScratchData
Back to greenflash's profile

GCF Calculator

GRgreenflash•Created December 27, 2009
GCF Calculator
12
9
837 views
View on Scratch

Description

This project will calculate the greatest common factor (GCF) of two numbers. Enter the larger one first and the smaller one second. This uses the Euclidean algorithm which works like this: Let's say you entered the numbers 20 and 12. Find the remainder of 20/12. (8). Take that number and find the remainder of your second number 12 by the remainder 8. (4) Continue this way by dividing the remainders until the remainder is zero. The number you divided by in the last step is the greatest common factor. For 20 and 12, it is 20/12 (remainder 8) 12/8 (remainder 4) 8/4 (remainder 0) So 4 is the GCF of 20 and 12 Congratulations to you if you understand how it works! I used two lists to help show how the algorithm works. This method is much faster and more efficient than finding the prime factors of a number and using them to determine the greatest common factor. Phew! That took awhile to write down! Enjoy! One sprite- One Script

Project Details

Project ID820784
CreatedDecember 27, 2009
Last ModifiedDecember 27, 2009
SharedDecember 27, 2009
Visibilityvisible
CommentsAllowed