Smallest Common Multiple-How can 1 and 5 have 60 as LCM

Tell us what’s happening:
Ok. Unless my math has become bad but how is the smallest common multiple of 1 and 5 equal to 60? The code I wrote gives me 5, which by my math is correct.

Your code so far

function smallestCommons(arr) {
  var a, b, r;
  a = arr[0];
  b = arr[1];
  
  function GCD(a,b){
    if (a > b && b !== 0){ 
      r = a % b;
    if ( r === 0){ return b;}
      else {return GCD(b,r);}
    
    }
    
    if (b > a && a !== 0){ 
      r = b % a;
    if ( r === 0){ return a;}
      else {return GCD(a,r);}
  }
    if (a===b && b !== 0) { return a;}
    if ( b === 0 && a !== 0) { return a;}
    if (a === 0 && b !== 0) { return b;}
  
  
}
  return (a*b/GCD(a,b));
}



smallestCommons([1,5]);

Your browser information:

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

Link to the challenge:
https://www.freecodecamp.org/challenges/smallest-common-multiple

The smallest common multiple of the numbers from 1 to 5 is 60.

OH I get it , numbers between 1 and 5 not just 1 and 5. I get it. Thank you

1 Like

I struggled to understand why for 30 minutes this morning :sob: