### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,123)
- misc (2)
- project euler (2)
- puzzle (31)
- site news (43)
- tantalizer (31)
- teaser (3)

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

11 January 2012

Posted by on **From New Scientist #2847, 14th January 2011** [link]

I have constructed a 3×3 magic square – that is, it contains nine different whole numbers and each row, column and main diagonal has the same sum. But my numbers are in a base other than 10 and I have used letters for the higher “digits”, namely A for 10, B for 11, C for 12, and so on, as far as necessary. The result is that one of the entries in my square now reads as “DO” (the letters D and O) and the bottom row of the square, when read right across, makes the word “MAGIC”.

In decimal notation, (a) What base was I working in? (b) What is the sum of each row?

[enigma1680]

Advertisements

%d bloggers like this:

The following Python program tries all bases up to 36 (when we run out of letters), and finds the solution in 30ms.

The magic square is (in base 10 and base 34):

Solution:(a) base 34, (b) 1398.Jim, I guess you’re solution was a lucky shot. Where did you get the s4=s/3 from? By coincidence, this is the case, but if it hadn’t, you’re solver would not have worked…

It’s a property of 3×3 magic squares. You can solve the equations yourself to prove it, or you can get SymPy to do it for you:

Consider the three non-horizontal lines that go through the centre square, as they are magic lines they all sum to

s,so:rearranging gives:

since the bracketed terms are also magic lines, each one sums to

s,hence:I see, awesome.