#' Euclidean algorithm
#'
#' Retunrs the greatest common divisor between a and b.
#'
#' @param b A numeric value not equal to zero.
#' @param a A numeric value not equal to zero.
#'
#' @return The greatest common divisor between \code{a} and \code{b}.
#'
#' @references https://en.wikipedia.org/wiki/Euclidean_algorithm
#'
#' @examples
#' euclidean(18,84)
#' euclidean(16,2120)
#'
#' @export
euclidean<-function(a,b){
stopifnot(is.numeric(a),is.numeric(b))
stopifnot(length(a)==1,length(b)==1)
while(a != 0){
k<-a
a<-b%%a
b<-k
}
return(abs(b))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.