Topics /
Math & Algorithms
The most popular blog posts about math & algorithms on Hacker News. 2,851 posts.
Simulating Wind on Procedural Terrain Using Lattice Boltzmann Method
Note: The full source code for this article can be found here (summarized version). Individual sections contain references to specific code snippets below.
The expected value of the game is positive regardless of Ballmer’s strategy
A few days ago John Graham-Cumming posted about “Steve Ballmer’s incorrect binary search interview question” which drew a lot of attention on Hacker News. The Ballmer’s favorite brain teaser goes like this:
Shortest bit sequence that's never been sent over the Internet (2017)
We can never know for sure because we don't have a comprehensive list of all the data. But what can we say probabilistically? Restating it like so:
The new APT 3.0 solver
APT 2.9.3 introduces the first iteration of the new solver codenamed solver3, and now available with the –solver 3.0 option. The new solver works fundamentally different from the old one. How does it work? Solver3 is a fully backtracking dependency solving algorithm that defers choices to as late as possible. It…
NYC subway math
Apparently MTA (the company running the NYC subway) has a real-time API. My fascination for the subway takes autistic proportions and so obviously I had to analyze some of the data.
Stacking triangles for fun and profit
One thing you may have noticed about the trigonometric functions sine and cosine is that they seem to have no agreed upon definition. Or rather, different authors choose different definitions as the starting point, mainly based on convenience. This isn’t problematic or even particularly unusual in mathematics: as long…
How I created two images with the same MD5 hash
I posted the following images the other day which although looking totally different have exactly the same MD5 hash ( e06723d4961a0a3f950e...
Faster than radix sort: Kirkpatrick-Reisch sorting
Radix sort sorts n w-bit integers by splitting them up into chunks of logn\log nlogn bits each, and sorting each chunk in linear time. Thus it achieves O(nw/logn)O(nw/\log n)O(nw/logn) time.
Data Compression Explained (2012)
Copyright (C) 2010-2012, Dell, Inc . You are permitted to copy and distribute material from this book provided (1) any material you distribute includes this license, (2) the material is not modified, and (3) you do not charge a fee or require any other considerations for copies or for any works that incorporate…
Understanding Programs Using Graphs
I want to show you a little of what this sea-of-nodes graph data structure looks like and how it works, and I think it’s worth doing this for this for a couple of reasons.
Visual explanations of mathematics (2020)
It is thought that Euclid wrote Elements in about 300 BC, but Oliver Byrne turned it into one of the true gems of visualization — and made it about 100 times more readable. By seamlessly combining typeset text (Caslon, if you’re interested) with minimalist geometric drawings in primary col
Poisson Disk Sampling
Stripe Across is a grog. We hope you enjoy it.
Very Wrong Math
The difference between misinformation and disinformation is the difference between ignorance and malice. Trolling is somewhat different, incorporating an element of provocation and narcissism. But what the hell is this?
A regular expression to check for prime numbers
Regular expressions are extremely powerful. This is something I read at least once or twice every day while reading articles and blogs on the Web.
Ethiopian Binary Math
Today, a witch doctor practices computer arithmetic. The University of Houston's College of Engineering presents this series about the machines that make our civilization run, and the people whose ingenuity created them. The scene is a remote Ethiopian village in 1940. A Farmer offers his herd of 34 goats for sale…
MathBox 2: PowerPoint Must Die
PowerPoint must die.
The Smallest Hash Table
This December I once again did the Advent of Code , in Rust. If you are interested, my solutions are on Github. I wanted to highlight one particular solution to the day 2 problem as it is both optimized completely beyond the point of reason yet contains a useful technique. For simplicity we’re only going to do part 1…
Mathematical Patterns That Eventually Fail
Sometimes patterns can lead you astray. For example, it’s known that $latex \displaystyle{ \mathrm{li}(x) = \int_0^x \frac{dt}{\ln t} }$ is a good approximation to $latex \pi(x),$ the number …
Reinforcement learning, explained with a minimum of math and jargon
To create reliable agents, AI companies had to go beyond predicting the next token.
Has an uncomfortable truth been suppressed?
Update to post, added 11th September. As expected, there is another side to the story discussed below. See this statement about the decision by the Mathematical Intelligencer and this one about the…
Do simpler machine learning models exist and how can we find them?
The above is the title of a talk by computer scientist Cynthia Rudin. here’s the abstract:
Seemingly impossible functional programs (2007)
Andrej has invited me to write about certain surprising functional programs. The first program, due to Ulrich Berger (1990), performs exhaustive search over the “ Cantor space ” of infinite sequences of binary digits. I have included references at the end. A weak form of exhaustive search amounts to checking whether…
B-Trees Require Fewer Comparisons Than Balanced Binary Search Trees
A blog by and for database architects.
Base-122 – A space efficient alternative to base-64
A space efficient UTF-8 binary-to-text encoding