Durer's Magic Square

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Search

 

Search DelphiForFun.org only

Support DFF

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.

In Association with Amazon.com

 

Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

 

 

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

 

Search DelphiForFun.org only

 

 

 

 

Problem Description

Dürer's Magic Square is contained in a famous copper engraving, "Melancholia", created in 1514 by German artist Albrecht Dürer.

There are 86 different combinations of four numbers from the square that sum to it's magic number, 34! 

How many can you find? 

Background & Techniques

Albrecht Dürer is generally considered to be  Germany's most famous Renaissance artist.   He was about 20 years younger than Leonardo da Vinci and around 1500 became greatly interested in the relationship between mathematics and art.  Leonardo and his contemporary, mathematician Pacioli, almost certainly influenced Dürer in these studies.   In 1514 he created the copperplate engraving named "Melancholia I" which contained this magic square - the first magic square published in Europe.  (Notice that the creation date of the picture, 1514, is contained in the bottom row of the square.) 

The program will sequentially display all 86 ways to pick four numbers that sum to 34.  The button to start this display is hidden until the user has identified 20 solutions.  The first 20 or so are not too difficult to find.  After that, finding solutions by inspection becomes increasingly difficult.  I have yet to find more than 40 solutions - and I have watched the program solution several times!   

The programming for this problem is fairly straightforward.  A StringGrid is used to display the square and an OnDrawCell exit to highlight the current set of selected cells, whether selected by the user or the program.  To accomplish this, an array of strings, S, contains the selected cell values.  As each cell is drawn, its value is compared to the values in S and if a match is found, the cell is highlighted.     User solutions are placed in a Listbox Stringlist.  In order to block duplicate solutions, we sort the four numbers before adding them to the list so that  Items.IndexOf procedure can  be used to check for duplicate solutions.   

Addendum  September 8,. 2003:  Viewer Don Rowland recently noticed a minor problem while finding solutions -  the program allowed the same square to be selected more than once.  Together we came with the fix which was posted today. . 

Running/Exploring the Program 

bulletBrowse source extract
bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

I wonder - how many of the 86 solutions are symmetric?   I haven't really made a study of symmetry but it seems that a solution would be symmetrical if you could fold the square along a straight line so that the solution squares overlapped exactly.   Is  flipping and rotating the square the same logical operation as folding? 

  

 

Original Date: January 19, 2003 

Modified: May 18, 2009

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2013, Gary Darby    All rights reserved.