Topics /

Math & Algorithms

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

Any year
1064

A trick to eliminate 2π (sometimes)

As a physicist, I’ve learned that the presence of 2 π 2\pi 2 π [▼] [ Or rather τ \tau τ , as it should actually be called . ] in a formula usually spells trouble. It’s kind of annoying to write by hand, easy to forget, and it’s dimensionless, so you can’t easily check if you forgot to divide or multiply by it…

1067

My favorite prime number generator

Many years ago I've re-posted a Stack Overflow answer with Python code for a terse prime sieve function that generates a potentially infinite sequence of prime numbers ("potentially" because it will run out of memory eventually). Since then, I've used this code many times - mostly because it's short and clear. In this…

1074

How Far Can You Get From McDonald's?

This summer, cruising down the I-5 through California’s Central Valley to the Los Angeles Basin, I unwittingly stumbled upon a most exasperating development: the country strip mall . First, let me state that I don’t hate. I’ve got nothing against Petco, Starbucks, OfficeMax, et al. When overcome by the desire for a…

1079

How Fair Is My D20? (2015)

An automatic system for rolling a polyhedral die and taking photos of the rolls; extracting the image of just the die from those images; clustering the images of the die by which face is shown; and analyzing the results.