<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);
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.