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.
Sometimes the reason pi shows up in randomly generated values is obvious—if there are circles or angles involved, pi is your guy. But sometimes the circle is cleverly hidden, and sometimes the reason pi pops up is a mathematical mystery!
In the weeks leading up to September 1891, mathematician Georg Cantor prepared an ambush. For years he had sparred - philosophically, mathematically and emotionally - with his formidable rival Leopold Kronecker, one of Germany's most influential mathematicians. Kronecker thought that mathematics should deal only with whole numbers and proofs built from them and therefore rejected Cantor's study of infinity. "God made the integers," Kronecker once said. "All else is the work of man."
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: