Back to front pageView on Hacker News (opens in a new tab)Ask HN: What's your favorite elegant/beautiful algorithm?733 pointsby algobuddy (on Hacker News)8 years agoComments (491) 209 threadsShow all commentsShowing thread 163 of 209[-]greenpizza138 years ago1 reply#I love the Sieve of Eratosthenes. Even if it's not the most optimal, I find it a very clever and beautiful way to find prime numbers up to a given point.chillee8 years ago#So the typical sieve of Eratosthenes is O(N log log N). Perhaps surprisingly, you can actually write a sieve that's O(N).
Ask HN: What's your favorite elegant/beautiful algorithm?733 pointsby algobuddy (on Hacker News)8 years ago
greenpizza138 years ago1 reply#I love the Sieve of Eratosthenes. Even if it's not the most optimal, I find it a very clever and beautiful way to find prime numbers up to a given point.
chillee8 years ago#So the typical sieve of Eratosthenes is O(N log log N). Perhaps surprisingly, you can actually write a sieve that's O(N).
Comments (491) 209 threads
Show all comments
Showing thread 163 of 209