Topics /

Math & Algorithms

The most popular blog posts about math & algorithms on Hacker News. 266 posts.

2024
125

Compressing chess moves for fun and profit

UPDATE: I’ve written a new post with a new technique which is about 2.5x more efficient than this approach Chess notation has come a long way since descriptive notation, now we have nice and decipherable Standard Algebraic Notation, like Qxf7 (queen takes on f7) or Nf3 (knight takes on f3). This is a great text…

128

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…

133

What P vs. NP is about

We recently made a Polylog video about a nonstandard way of understanding the P vs NP problem. As usual, our goal was to present an underrated idea in a broadly understandable way, while being slig…

134

The Art and Mathematics of Genji-Ko

You might think it’s unlikely for any interesting mathematics to arise from incense appreciation, but that’s only because you’re unfamiliar with the peculiar character of Muromachi (室町) era Japanese nobles. There has never been a group of people, in any time or place, who were so driven to display their sophistication…

141

Win your fantasy league using operations research

I’ve never been good at playing football 1 . I started playing again last year and I have scored more own goals than goals for my team. Also, I support the RCD Espanyol 2 , which has spent last season in the second division and has miraculously ascended to the first division last week. And to be honest, I only watch…

143

Constructing a Four-Point Egg

For reasons beyond the scope of this entry, I have been investigating elliptical and ovoid shapes. The Wikipedia article for Moss’s egg has a link to a tutorial on Euclidean Eggs by Freyja Hreinsdóttir which (amongst other things) describes how to construct the “four point egg”. I think it is a nicer shape than Moss’s…

146

Dividing unsigned 8-bit numbers

Division is quite an expensive operation. For instance, latency of the 32-bit division varies between 10 and 15 cycles on the Cannon Lake CPU, and for Zen4 this range is from 9 to 14 cycles. The latency of 32-bit multiplication is 3 or 4 cycles on both CPU models.