tags:

views:

68

answers:

1

I want a logic for how to get unique sum like in 3x3 matrix the number from 1 to 9 (should not be repeated) the matrix looks like

4 9 2

3 5 7

8 1 6

here the sum is 15.

if i input 3x3 matrix it should return this matrix

please help.

A: 

You're thinking of the Magic Square problem, I would guess:

http://pages.prodigy.net/tetrasulfide/magicsquares.html

Amber
it only works for odd matrix like 3x3 not 4x4
jk
http://en.wikipedia.org/wiki/Magic_square
Amber