Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let sumPrimes = function(n) {
- return Array
- .from(Array(n).keys())
- .slice(1)
- .filter(n => {
- for(let i = 2; i < n; i++) if(n % i == 0) return false;
- return true;
- })
- .reduce((acc, n) => acc + n);
- };
Add Comment
Please, Sign In to add comment