Instantly share code, notes, and snippets.

What would you like to do?
GCD - Greatest Common Divisor
package cryptogcd
//GCD Greatest Common Divisor (Factor)
func GCD(a, b int) int {
var Remainder int
for {
Remainder = a % b
a = b
b = Remainder
if b == 0 {
return a

This comment has been minimized.

Copy link
Owner Author

AmirSoleimani commented Nov 21, 2018

GCD is known as the greatest common divisor, or greatest common factor (gcf), and is the largest positive integer that divides into two numbers without a remainder. For example, the GCD of 9 and 15 is 3. It is an operation that is used many encryption algorithms

9, 15 -> 3
54, 8 -> 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment