euclidean: euclidean algorithm

Description Usage Arguments Value References Examples

View source: R/euclidean.R

Description

This function is a loop algorithm to find the greatest common divisor (GCD) of two nonzero number x and y using euclidean algorithm. If the lager number devided by the smaller number has a nonzero remainder,replace the lager number with remainder.Reverse the step until the remainder is zero, then the denominator is GCD of the original two numbers.

Usage

1
euclidean(x, y)

Arguments

x

A number

y

A number

Value

greatest common divisor (GCD) of x and y

References

https://en.wikipedia.org/wiki/Euclidean_algorithm

Examples

1
2
euclidean(100,1000)
euclidean(1234,8888)

rui0027/lab03 documentation built on Dec. 22, 2021, 8:12 p.m.