Advertisement
ErolKZ

Untitled

Sep 11th, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1.  
  2. function smallestMult(n) {
  3.  
  4. let counter = 0;
  5.  
  6. for (let j = 1; j <= Number.MAX_SAFE_INTEGER; j++) {
  7.  
  8. counter = 0;
  9.  
  10. for (let i = 1; i <= n; i++) {
  11.  
  12. if (j % i === 0) {
  13.  
  14. counter++;
  15.  
  16. if (counter === n) {
  17.  
  18. return j;
  19.  
  20. }
  21.  
  22. }
  23.  
  24. }
  25.  
  26. }
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33. console.log(smallestMult(20));
  34.  
  35. // 60
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement