Topics /
Math & Algorithms
The most popular blog posts about math & algorithms on Hacker News. 238 posts.
Set theory with types
It is known that mathematics is heavily reliant on set theory, but no one can agree on what set theory is. Many people today understand that we have a choice between set theory and type theory , but they don’t know what type theory is either. Many think that type theory refers to some sort of dependent type theory, as…
2D Signed Distance Functions
Tutorials and articles of Inigo Quilez on computer graphics, fractals, math, art, demoscene, shaders and more.
The Mathematics of Crochet
I remember thinking at school when will I ever in my “real life” use maths. Well much to my utter surprise I’ve come to the stark realisation that there is a link between mathematics and crochet. …
An election forecast that’s 50-50 is not “giving up”
tl;dr. In 2024, pre-election polls were off by about 2 percentage points. Election forecasters were aware of this and incorporated this into their uncertainties. But if you were not following the forecasts carefully, you might’ve not realized this. You might have mistakenly thought that, when predictions happened to…
There's Math.random(), and then there's Math.random() (2015)
V8’s Math.random implementation now uses an algorithm called xorshift128+, improving the randomness compared to the old MWC1616 implementation.
Quaternions and spherical trigonometry
Hamilton’s quaternion number system $latex {\mathbb{H}}&fg=000000$ is a non-commutative extension of the complex numbers, consisting of numbers of the form $latex {t + xi + yj + zk}&f…
100 years of Zermelo's axiom of choice: What was the problem with it? (2006)
Cantor conceived set theory in a sequence of six papers published in the Mathematische Annalen during the five year period 1879–1884. In the fifth of these papers, published in 1883, 1 he stated as a law of thought ( Denkgesetz ) that every set can be well-ordered or, more precisely, that it is always possible to…
Parser Combinators Beat Regexes
Someone online was solving Advent of Code problems, and had a question about last years’ day 3 . They had a working solution using regular expressions (regexes) on String values, but they wanted to use ByteString values instead for performance reasons. They were surprised, however, that there seems to be a lack of…
How many dimensions is this?
A degree in mathematics might not save you from stacking boxes for a living.
The Buenos Aires Constant
Generating primes using the Buenos Aires constant.
Why cryptography is not based on NP-complete problems
Cryptographic schemes are based on the computational difficulty of solving some ‘hard’ problem. For example, RSA (specifically, RSA-2048) is based on the difficulty of a problem like this:
The inefficiency of RL, and implications for RLVR progress
And implications for RLVR progress
Dumb statistical models, always making people look bad
This is Jessica. In my Prediction for Decision-making class last quarter we talked about human predictions and decisions relative to algorithmic ones. This led to a discussion about why it’s often hard to demonstrate the value of human knowledge once you have a decent statistical model.
Modeling the World in 280 Characters
An exploration of the mindset, methods, and motivations behind crafting tiny, expressive shaders that combine code, art, and constraint.
Lossless Float Image Compression
Back in 2021 I looked at OpenEXR lossless compression options (and I think my findings led a change of the default zip compression level , as well as change of the compression library from zlib to libdeflate . Yay blogging about things!) . Then in 2023 I looked at losslessly compressing a bunch of floating point data…
Graph Theory Applications in Video Games
A detailed look at Graph Theory and how it can be applied to video games.
Zero knowlege proof of compositeness
Testing whether a number is composite as an example of a zero knowledge proof. How ZKPs are used more generally.
SATisfying Solutions to Difficult Problems
This post covers the same material as my !!Con 2024 talk , for which the slides are here .
Million Times Million
Is a million times a million a billion or is it a trillion ? For my entire childhood, it was a billion, only for me to grow up and realise, as an adult, that it had better be a trillion!
Closing the “green gap”: energy savings from the math of the landscape function
I recently returned from the 2025 Annual Meeting of the “Localization of Waves” collaboration (supported by the Simons Foundation, with additional related support from the NSF), where I…
Perfecting anti-aliasing on signed distance functions
Doing anti-aliasing on SDF is not as straightforward as it seems. Most of the time, we see people use a smoothstep with hardcoded constants, sometimes with screen space information, sometimes cryptic or convoluted formulas. Even if SDFs have the perfect mathematical properties needed for a clean anti-aliasing, the…
Inverting the Xorshift128 random number generator
CVE-2025-7783 is a very recent vulnerability affecting a lot of applications in the Node.js ecosystem including those which use axios or the deprecated request library. In all honesty, this vulnera…
The new Gödel Prize winner tastes great and is less filling
David Zuckerman The 2025 Gödel Prize has been awarded to Eshan Chattopadhyay and David Zuckerman for their paper Explicit two-source extrac...
Solving a “Layton Puzzle” with Prolog
I have a lot in the works for the this month's Logic for Programmers release. Among other things, I'm completely rewriting the chapter on Logic Programming...
Iterated Log Coding
I've created a new format for encoding real numbers on computers. I'm proud of it! Let's dive in.
Picturing Mathematics
I’m a great believer in low-tech math. I don’t like to rely on things a computer tells me; what if there’s a bug in the code? I prefer trusting things that I can check for myself. At the same…