vuyisile.github.io

View on GitHub
14 November 2017

Smallest Common Multiple

by {"name"=>"Vuyisile Weni"}

What is a common multiple?

A multiple of a number is the product of that number and an integer. For example, 10 is a multiple of 5 because 5 × 2 = 10, so 10 is divisible by 5 and 2. Because 10 is the smallest positive integer that is divisible by both 5 and 2, it is the least common multiple of 5 and 2. By the same principle, 10 is the least common multiple of −5 and −2 as well.

According to Wikipedia, In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers a and b, usually denoted by LCM(a, b), is the smallest positive integer that is divisible by both a and b. Since division of integers by zero is undefined, this definition has meaning only if a and b are both different from zero. However, some authors define lcm(a,0) as 0 for all a, which is the result of taking the lcm to be the least upper bound in the lattice of divisibility.

Instructions (the rules)

Why I find it difficult to complete this challenge:

Well the first part was quiet easy because what I had to is make range between the minimum number and the maximum number, but finding a common multiple between the minimum number and the maximum number was difficult because I had to consider the fact that the multiple should also be common to all sequential numbers in the range between these parameters.

tags: