The Birthday Square

https://commons.wikimedia.org/wiki/File:Ramanujan_magic_square_construction.svg
Image: Wikimedia Commons

Srinivasa Ramanujan devised this magic square to mark his own birthday. He began with a Latin square (upper right) in which the numbers 1, 2, 3, and 4 appear in each row, column, and long diagonal as well as in the four corners, the four central squares, the middle squares in the top and bottom rows, and the middle squares in the outermost columns. Note the adjustments that would be necessary to reduce the four top cells to zero, and arrange these adjustments in the diagonally reflected pattern shown in the upper left. Now adding these two squares together produces the square in the lower left, which gives us a formula for creating a magic square based on any date (in the format 1 January 2001). The example at lower right is based on Ramanujan’s own birthday, 22 December 1887 (so D = day = 22, M = month = 12, C = century = 18, and Y = year = 87). In this example all 16 numbers are distinct, but that won’t be the case with every date.