Created
April 8, 2022 10:40
-
-
Save fronterior/a31ea46ec9c3a4b3ac75bae16b3979e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function* getDivisor(n) { | |
let temp = 0; | |
for (let i = 1; i <= n; i++) { | |
if (n % i) continue; | |
if (temp === i) break; | |
yield i; | |
temp = n / i; | |
yield temp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment