Winners of the Pi-day challenge 2023

The Pi-dag challenge 2023 has three very convincing winners. It was clearly a nice challenge for software engineers with a knack for mathematics. There were some very interesting and surprising solutions. Some made creative use of loopholes in the rules, but all displayed true coding skill.

The challenge was raised in the context of Pi-day, formally known as the International day of Mathematics. The task was to write the shortest and fastest algorithm that takes a list of numbers as input and returns the corresponding Pisaro numbers.

Several candidates did not so much solve the problem in the spirit of the rules but rather made creative use of the literal text of the rules. They found surprising ways to move parts of the code outside the actual program. For example: make it part of the file name and retrieve this filename from the actual code; use exec(“<python code…>”) to circumvent whitespace rules; and build a Cloud service to return the answers.

The winners

The top 3 submissions all converged to the same algorithm. The main difference was the degree to which they managed to push the last superfluous bytes from the code.

  1. Stef Maree
    Stef’s solution had the best score. Mostly because his file was only 64 bytes which he managed to do by putting the actual code in the filename. But even apart from this creative solution, he also found smart solutions that did not make use of loopholes in the rules.
  2. Jaap Versteegh
    Jaap found a very neat short solution. It is probably not as you would usually write a piece of Python code, but it was still very readable for such a compact code.
  3. Berry den Hartog
    Next to the algorithm that Jaap and Stef found, Berry knocked himself out on various other methods. Adding multiprocessing unfortunately did not provide enough speedup to compensate for the extra bytes in the code. Another interesting solution by Berry was to run a Cloud-service with the actual algorithm and then have the code simply ask for the solution. Again, we appreciated the creativity of the solution but just making the web request takes more characters in Python than the simplest implementation of the algorithm itself. Thus, the final score of this solution was not high enough.

Honorable mention

Finally, an honorable mention of Gerard Groenewegen. He submitted a solution written by ChatGPT, which was indeed a valid piece of Python code. One edge case (the first number in the list) didn’t work. But that was not in the test set, so the solution met the criteria. The code was not minimized in size, however, so the final score was not enough to make it to the top three.

Finally

We thank all the participants for their contributions. It feels good to see so much enthusiasm and coding skill. The winners will receive their prizes by mail.