Fixed error prone checking etc in codebase
This commit is contained in:
@ -9,7 +9,7 @@ const primes = num => {
|
||||
let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2),
|
||||
sqroot = Math.floor(Math.sqrt(num)),
|
||||
numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2);
|
||||
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x)));
|
||||
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y === x)));
|
||||
return arr;
|
||||
};
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user