Skip to content

Instantly share code, notes, and snippets.

@dorman99
Created September 6, 2021 13:15
Show Gist options
  • Save dorman99/b296daec326870ad964a085e772f544d to your computer and use it in GitHub Desktop.
Save dorman99/b296daec326870ad964a085e772f544d to your computer and use it in GitHub Desktop.
Find Factor Min 6
const list = [];
class Factor {
constructor(factor, total) {
this.factor = factor;
this.total = total || [];
this._findTotalFactor()
}
_findTotalFactor() {
for(let i = 1; i <= this.factor; i++) {
if (this.factor % i === 0) {
this.total.push(i)
continue
}
}
}
}
// change num
const num = 262144;
for(let i = 1; i <= num; i++) {
const f = new Factor(i, []);
list.push(f);
}
const listOfMin6Factor = list.filter(f => f.total.length === 6);
console.log(listOfMin6Factor.length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment