Created
September 6, 2021 13:15
-
-
Save dorman99/b296daec326870ad964a085e772f544d to your computer and use it in GitHub Desktop.
Find Factor Min 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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