I solved today’s /r/DailyProgrammer challenge. The challenge is easy, but both of the optional bonus problems are significantly more difficult, and I solved both of them.
The first bonus problem is to decide whether any given grid of integers forms a magic square. The second bonus problem is, given a grid whose bottom row is missing, to decide whether the given grid could possibly form a magic square.
I was reading John D. Cook’s blog, and I read that all 3 x 3 magic squares have an interesting property. Being both curious and skeptical, I wrote a little Python program to see for myself whether it’s true that they really do. The code is up at my GitHub.