Smallest Common Multiple Issue

Smallest Common Multiple Issue
0

#1

Tell us what’s happening:

Hi all, I can’t understand something about this Challenge. Does he acquire the smallest common multiple number so according to my knowledge for 1 5 as example = 5 because 1+1+1+1+1 = 5 and 5 , so it’s the smallest common multiple number, so why he gives 60 ?!

Your code so far

function smallestCommons(arr) {
  var multi0 = [];
  var multi1 = [];
  var sum0 = 0;
  for (var i = 0 ; i < 300 ; i ++){
    sum0 = arr[0] + sum0;  
    multi0.push(sum0);
  }
  var sum1 = 0;
  for (var j = 0 ; j < 300 ; j ++){
    sum1 = arr[1] + sum1;  
    multi1.push(sum1);
  }
  var common = [];
  for (var k =0 ; k <300 ; k++){
 if(multi1.indexOf(multi0[k]) !== -1){
   common.push(multi0[k]);
 }
  }
  return common;
}


smallestCommons([23,18]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36.

Link to the challenge:


#2

Read more about Smallest Common Multiple (also known as Least Common Multiple or LCM). Also, it is not just the numbers 1 and 5 in this challenge, it is finding the smallest common multiple for the numbers 1,2,3,4,5. That is why the answer is 60.


#3

Oh that’s it ! I didn’t know that it needs to apply to each number in between ! now it’s Ok. Thank you. :slight_smile:
As U R a moderator can I ask U for Help, Please ?