Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 2028. Magic Concentric Circles

Created by Ted

Consider 4 magic circle circles around a single number in the sequence 1:n where the sum along the diameters is always equal, and the sum for each circle is also equal.

If n=33 then return a truth function corresponding to whether the supplied matrix is magic or not. Diameter numbers are written in columns, and the centre number thus appears in each diameter sequence. Rows contain numbers along semi circles.

Example

 c = [ 20 33 12 4  ;
       16 1  31 21 ;
       23 13 19 4 ;
       10 22 7  30 ;
       9  9  9  9  ;
       2  18 25 34 ;
       29 26 11 3  ;
       32 17 5  15 ;
       6  8  28 27 ]; 

is not magic over 1:n

 c = [ 20 33 12 4  ;
       16 1  31 21 ;
       23 13 19 14 ;
       10 22 7  30 ;
       9  9  9  9  ;
       2  18 25 24 ;
       29 26 11 3  ;
       32 17 5  15 ;
       6  8  28 27 ]; 

is magic

See http://en.wikipedia.org/wiki/Magic_circle_(mathematics)

Tags

Problem Group

Solution Statistics

10 correct solutions 8 incorrect solutions
Last solution submitted on Dec 07, 2014

Problem Comments