## Teaser 2821: Magic cards

**From The Sunday Times, 16th October 2016** [link]

Joe placed nine cards on the table to form the magic square shown on the left below (where each row, column and diagonal has the same total). Then he turned over each card one at a time and the result is shown on the right below: it is not magic.

Penny then rearranged the cards to form a magic square which, after each card was turned over, was also magic.

What (in increasing order) were the four corner numbers in her magic square with the higher total?

[teaser2821]

## Jim Randell 9:58 am

on18 October 2019 Permalink |A magic square can be characterised using three variables:

x, y, zas the sums:Each row, column, and diagonal combine to give

3(x+y+z)= the magic constant.Given values for

a, e, fwe can derive:x = f, y = a – f, z = e – aand generate the complete square.This Python program solves the puzzle in 87ms.

Run:[ @repl.it ]Solution:The four corner squares are: 3, 7, 9, 13.The magic constant in the first square is 24, in the second square it is 18.

LikeLike