Sieve of Eratosthenes: an ancient algorithm for finding all prime numbers up to any given limit. Make a list of all the integers ≤ n. Strike out the multiples of all primes ≤ √n, then the numbers that are left are the primes.pic.twitter.com/PXZ6Zgcd62
-
-
Pretty nice way to interpret the algorithms of sieve of Eratosthenes into a coding language. It's a guide for math students and coders.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
var SieveOfEratosthenes=n=>{for(var a=[],o=[],i=0;i<n;i++){a[i]=1;}for(var i=2;i<=Math.sqrt(n);i++){if(a[i]){for(var j=i*i;j<n;j+=i){a[j]=0;}}}for(var i=2;i<n;i++){if(a[i]){o.push(i);}}return o;}
-
Yes. JavaScript arrow functions and Java lambdas don't require parenthesis if there is only one argument. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions …
End of conversation
New conversation -
-
-
Sorry, i don't speak Italian
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
And numbers like 311647 are amazing.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
This Tweet is unavailable.
New conversation -
-
What is that!!?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@Otto_Silva@AyeeAraujo y si hacemos de este código para el de complejidad?Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Lol so complicated, just use list comprehension with map function
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.