Topics /

Math & Algorithms

The most popular blog posts about math & algorithms on Hacker News. 2,851 posts.

Any year
1244

Hindley-Milner Type Inference (2012)

Robin Milner's type system with parametric polymorphism was a significant advance over the systems of Russell and Church. Arguably it is the ability to use type-variables that makes higher order logic a practical vehicle for proving non-trivial theorems. The Hindley-Milner algorithm is used to automatically infer…

1246

How random are TOTP codes?

I'm pretty sure that the 2FA codes generated by my bank's TOTP app have a bias towards the number 8 - because eight is an auspicious number. But is that just my stupid meaty brain noticing patterns where none exist? The TOTP algorithm uses HMAC, which in turn uses SHA-1. My aforementioned brain is not clever enough to…

1250

Reflected Diffusion Models

Diffusion models are trained to reverse a stochastic process through score matching. However, a lot of diffusion models rely on a small but critical implementation detail called thresholding. Thresholding projects the sampling process to the data support after each discretized diffusion step, stabilizing generation at…

1251

Swift Numerics

I’m excited to announce a new open-source project for the Swift ecosystem, Swift Numerics! Swift Numerics will provide the building blocks of numerical computing in Swift, as a set of fine-grained modules bundled together into a single Swift package. My hope is that we can quickly fill some important gaps in the…

1255

Algorithms tutorial series for beginners

As a developer, you have the power to change the world! You can write programs that enable new technologies. For instance, develop software to find an earlier diagnosis of diseases. But that’s not the only way. You might do it indirectly by creating projects that make people more productive and help them free up time…

1256

We're Knot Friends

It’s April Cools again. For a few summers in high school and undergrad, I was a day camp counselor. I’ve written before about how it helped me develop storytelling skills, but recently I thought of it again because, while I was cleaning out a closet full of old junk, I happened upon a bag of embroidery thread. While…

1258

The most famous transcendental numbers

The mathematical constant pi represents the ratio of the circumference of a circle to its diameter. It is the most famous ratio in mathematics both on Earth and probably for any advanced civilization in the universe. The number pi, like other fundamental constants of mathematics such as e = 2.718..., is a…

1260

“I don't know the numbers”: a math puzzle

I saw a math puzzle the other day on Hacker News. It reads as follows: Two numbers are chosen randomly, both are positive integers smaller than 100. Sandy is told the sum of the numbers, while Peter is told the product of the numbers. Then, this dialog occurs between Sandy and Peter: Peter: I don’t know the numbers…