find primes with underscore

by Terrance Smith

HTML

<p>Largest prime factor Problem 3 The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Input: an integer n > 1 Let A be an array of Boolean values, indexed by integers 2 to n, initially all set to true. for i = 2, 3, 4, ..., √n : if A[i] is true: for j = i2, i2+i, i2+2i, ..., n: A[j] := false Now all i such that A[i] is true are prime.
</p>

<a href="http://stackoverflow.com/questions/1510124/program-to-find-prime-numbers"> Finding Prime Numbers</a>

JavaScript

//result.RemoveAll(i => i > result[index] && i % result[index] == 0); 

var vals = _.range(2, 30);
_.reject(vals, index, function (num, index) {
    return (num > vals[index] && num % vals[index] === 0);
});