R/euclidean.R

#' @title euclidean Algorithem
#' @name  euclidean
#' @param a number
#' @param b number
#' @return greatest common divisor of two numbers
#' @description euclidian algorithm to find the greatest common divisor of two numbers 
#' @references \url{https://en.wikipedia.org/wiki/Euclidean_algorithm}
#' @export
## euclidean
euclidean<- function(a, b) {
  if (a == 0 | b == 0) {return(0)}
  z <- a %% b
  return(ifelse(z, euclidean(b, z), b))
}
fbarulli/Lib3AF documentation built on May 19, 2019, 1:43 a.m.