Skip to content

Instantly share code, notes, and snippets.

View taesup's full-sized avatar

Edward Kim taesup

View GitHub Profile
@taesup
taesup / smallest_multiple.js
Created July 25, 2019 07:49
Given a set of factors, find the smallest number where all the factors evenly divide into the number
console.time('test');
function smallestMultiple(num) {
if (num === 1) {
return 1;
}
// generate factors from 4 to num
let factors = {};
for (let i = 2; i <= num; i++) {
// factorization