R/euler_problem_1.R

Defines functions euler_problem_1

Documented in euler_problem_1

#' Project Euler Problem 1
#'
#' This function takes two natural numbers and finds the sum of all of their multiples below a certain limit.
#'
#' @param multiple1 A natural number
#' @param multiple2 A natural number
#' @param limit The upper limit for multiples of both natural numbers
#'
#' @return
#' @export
#'
#' @examples

euler_problem_1 <- function(multiple1, multiple2, limit) {
  sum(unique(c( seq(multiple1, limit, multiple1), seq(multiple2, limit, multiple2))))
}
alexclippinger/pastafish documentation built on Dec. 19, 2021, 12:32 a.m.