gcd: Finds the greatest (positive) common divisor of two integers.

Description Usage Arguments Value Examples

View source: R/domain.R

Description

Finds the greatest (positive) common divisor of two integers; if one of them is 0, returns the absolute value of the other number.

Usage

1
gcd(a, b)

Arguments

a

An integer.

b

An integer.

Value

The greatest (positive) common divisor of two integers; if one of them is 0, returns the absolute value of the other number.

Examples

1
2
3
4
5
6
7
gcd(1, 2)
gcd(1, -2)
gcd(12, -18)
gcd(-12, 18)
gcd(15, 0)
gcd(0, -15)
gcd(0, 0)

genscore documentation built on April 28, 2020, 1:06 a.m.