gcd: Computes the greatest common divisor with several algorithms...

Description Usage Arguments Value Examples

Description

Computes the greatest common divisor with several algorithms available. The default algorithm is the recursive method, which is typically faster than the others.

Usage

1
gcd(a, b, method = "recursive")

Arguments

a

First integer

b

Second integer

method

Specifies the algorithm used to calculate the greatest common divisior. Defaults to 'recursive', which is generally faster than other methods. Other algorithms available include 'division' and 'subtraction'.

Value

The greatest common divisor

Examples

1
2
3
gcd(21, 28)
gcd(30, 10, 'subtraction')
gcd(21, 6, 'division')

aschleg/numberr documentation built on May 14, 2019, 10:31 a.m.