The sum of the first 100 primes using the Gentoo library
function isPrime(number) { var start = 2; while (start <= Math.sqrt(number)) { if (number % start++ < 1) return false; } return number > 1; } const sum = gentoo.chain(gentoo.range(1, Number.POSITIVE_INFINITY)) .filter(isPrime) .limit(100) .reduce((memo, val) => memo + val, 0) .value() document.write(sum);