<-- Previous || Up || Next -->

Greatest Common Divisor Function
Math Arithmetic Class

Public Function GreatestCommonDivisor( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    ) As Variant

Return the largest number equally divisible by both numbers.
Also known as GCD and Greatest Common Factor and GCF.

Examples:
    GreatestCommonDivisor(7, 97) = 1
    GreatestCommonDivisor(12, 64) = 4
    GreatestCommonDivisor(96, 256) = 32
    GreatestCommonDivisor(96, -64) = 32
    GreatestCommonDivisor(-96, 64) = 32
    GreatestCommonDivisor(4590, 1240) = 10
    GreatestCommonDivisor(4590324, 12401234) = 2
See also:
    LeastCommonMultiple Function
vX: First of two numbers whose greatest common factor is to be calculated. Function returns Null if vX is Null or cannot be fixed up to a number.

vY: Second of two numbers whose greatest common factor is to be calculated. Function returns Null if vY is Null or cannot be fixed up to a number.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.