mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-13 22:00:19 -04:00
fix(curriculum): slighly faster solution for euler47 (#46487)
euler47 - slighly faster soln
This commit is contained in:
committed by
GitHub
parent
64ded859bd
commit
4afd13489a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user