fix(curriculum): slighly faster solution for euler47 (#46487)

euler47 - slighly faster soln
This commit is contained in:
Jeremy L Thompson
2022-06-16 07:15:23 -06:00
committed by GitHub
parent 64ded859bd
commit 4afd13489a

View File

@@ -68,13 +68,13 @@ distinctPrimeFactors(4, 4);
```js
// Initalize factor count with seive
const NUMFACTORS = Array(150000).fill(0);
const NUMFACTORS = Array(135000).fill(0);
(function initFactors(num) {
for (let i = 2; i < num; i++)
if (NUMFACTORS[i] === 0)
for (let j = i; j < num; j += i)
NUMFACTORS[j]++;
})(150000);
})(135000);
function distinctPrimeFactors(targetNumPrimes, targetConsecutive) {
let numConsecutive = 0;