euclidean: Euclidean algorithm

Description Usage Arguments Details Value Source

View source: R/euclidean.R

Description

euclidean returns the greatest common divisor of two integers.

Usage

1
euclidean(x, y)

Arguments

x

a number or integer.

y

a number or integer.

Details

The algorithm is a method for computing the largest possible number that divides two numbers without a remainder. It works by replacing the larger number by its difference with the smaller of the two numbers and repeating this process until the two numbers become equal and the remainder is zero.

Value

If the two inputs are integer or numeric, then the output will be an integer, specifically the highest number that will divide the two inputs. Otherwise the function will stop and show an error stating the inputs need to be an integer or numeric.

Source

Wikipedia


zoepatton/732A94_Lab3 documentation built on Nov. 16, 2020, 1:42 p.m.