For more than two millennia, mathematicians have produced a growing heap of pi equations in their ongoing search for methods to calculate pi faster and faster. The pile of equations has now grown into the thousands, and algorithms now can generate an infinitude. Each discovery has arrived alone, as a fragment, with no obvious connection to the others. But now, for the first time, centuries of pi formulas have been shown to be part of a unified, formerly hidden structure.
Pi is an infinitely long decimal number that never repeats. How do we know? Well, humans have calculated it to 314 trillion decimal places and didn't reach the end. At that point, I'm inclined to accept it. I mean, NASA uses only the first 15 decimal places for navigating spacecraft, and that's more than enough for earthly applications.
Which Algorithm Is This? If you step back, this maps almost perfectly to the Top K Frequent Elements problem.We usually solve it for integers in a list. Here, the "elements" are audience profiles age and body-type combinations. First, define what an audience profile looks like: case class Profile(age: Int, height: Int, weight: Int) What we want is a function like this: