gcd: Greatest Common Divisor

Description Usage Arguments Details Value Author(s) Examples

View source: R/peacock_gcd.R

Description

This function returns the greatest common divisor of two integers

Usage

1
gcd(x, y)

Arguments

x

a nonnegative integer

y

a nonnegative integer

Details

The function utilizes the Euclidean algorithm to compute the greatest common divisor of two integers

Value

An integer, which is the greatest common divisor. If both arguments are zero, then the returned value is 1.

Author(s)

Yuanhui Xiao

Examples

1
2
3
4
x <- 4
y <- 6
d <- gcd(x, y)
d

Example output

[1] 2

Peacock.test documentation built on May 2, 2019, 4:50 a.m.