Top posts

Every blog post that took off on Hacker News, ranked by the votes of its best submission. 2,851 posts.

Math & Algorithms
Any year
1924

Categories from scratch

Note The latest version of this document can be found online at https://dr-knz.net/categories-from-scratch.html. Alternate formats: Source, PDF. Prologue The concept of category from mathematics happens to be useful to computer programmers in many ways. Unfortunately, all “good” explanations of categories so far have…

1936

Step-by-Step Math

Have you ever given up working on a math problem because you couldn’t figure out the next step? Wolfram|Alpha can guide you step by step through the process of solving many mathematical problems, from solving a simple quadratic equation to taking the integral of a complex function.

1950

A Fairly Fast Fibonacci Function

A common example of recursion is the function to calculate the $n$-th Fibonacci number: def naive_fib(n): if n < 2: return n else: return naive_fib(n-1) + naive_fib(n-2) This follows the mathematical definition very closely but it’s performance is terrible: roughly $\mathcal{O}(2^n)$. This is commonly patched up with…