Tell us what’s happening:
Hello,
I am curious what you think of my idea:
A - take the upper value and create multiples (multiply it by [2 … upperValue -1] in a loop)
B- in another loop: check for the multiple, if it is divisible without rest by the other numbers of the submitted range
C-- if yes, the muliple is the LCM
D-- if no, take the next multiple of the upper value (go to C)
What do you think of that and are there any other ideas out there?
I already implemented the code successfully.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Implement a Range-Based LCM Calculator - Implement a Range-Based LCM Calculator
ILM
December 15, 2025, 11:03am
3
that would work, you could also research LCM and GCD algorithms
In arithmetic and number theory, the least common multiple (LCM), lowest common multiple, or smallest common multiple (SCM) 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, since 0 is the only common multiple of a and 0.
The least common multiple o...
In mathematics, the greatest common divisor (GCD), also known as greatest common factor (GCF), of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For two integers x, y, the greatest common divisor of x and y is denoted
gcd
(
x
,
y
)
{\displaystyle \gcd(x,y)}
. For example, the GCD of 8 and 12 is 4, that is, gcd(8, 12) = 4.
In the name "greatest com...
1 Like