src/vendor/leemon.js
function findPrimes(n) {
  var i, s, p, ans;
  s=new Array(n);
  for (i=0; i<n; i++)
    s[i]=0;
  s[0]=2;
  p=0;    //first p elements of s are primes, the rest are a sieve
  for (;s[p]<n;) {                  //s[p] is the pth prime
    for (i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
      s[i]=1;
    p++;
    s[p]=s[p-1]+1;
    for (; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
  }
  ans=new Array(p);
  for (i=0; i<p; i++)
    ans[i]=s[i];
  return ans;
}
function findPrimes(n) {
  var i, s, p, ans;
  s=new Array(n);
  for (i=0; i<n; i++)
    s[i]=0;
  s[0]=2;
  p=0;    //first p elements of s are primes, the rest are a sieve
  for (;s[p]<n;) {                  //s[p] is the pth prime
    for (i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
      s[i]=1;
    p++;
    s[p]=s[p-1]+1;
    for (; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
  }
  ans=new Array(p);
  for (i=0; i<p; i++)
    ans[i]=s[i];
  return ans;
}
function findPrimes ( n ) { var i , s , p , ans ; s = new Array ( n ) ; for ( i = 0 ; i < n ; i ++ ) s [ i ] = 0 ; s [ 0 ] = 2 ; p = 0 ; //first p elements of s are primes, the rest are a sieve for ( ; s [ p ] < n ; ) { //s[p] is the pth prime for ( i = s [ p ] * s [ p ] ; i < n ; i += s [ p ] ) //mark multiples of s[p] s [ i ] = 1 ; p ++ ; s [ p ] = s [ p - 1 ] + 1 ; for ( ; s [ p ] < n && s [ s [ p ] ] ; s [ p ] ++ ) ; //find next prime (where s[p]==0) } ans = new Array ( p ) ; for ( i = 0 ; i < p ; i ++ ) ans [ i ] = s [ i ] ; return ans ; }
return array of all primes less than integer n
return array of all primes less than integer n