Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #51 Oct 31 2023 11:03:19
%S 2,7,6,9,5,1,4,3,8,2,9,4,7,5,3,6,1,8,4,3,8,9,5,1,2,7,6,4,9,2,3,5,7,8,
%T 1,6,6,1,8,7,5,3,2,9,4,6,7,2,1,5,9,8,3,4,8,1,6,3,5,7,4,9,2,8,3,4,1,5,
%U 9,6,7,2
%N Rows of the 8 magic squares of order 3 and magic sum 15, lexicographically sorted.
%C See A320871, A320872 and A320873 for the list of all 3 X 3 magic squares of distinct integers, primes, resp. consecutive primes. In all these, only the lexicographically smallest of the eight "equivalent" squares are listed. Note that the terms are not always in the order that corresponds to the terms of this sequence. For example, in row 3 of A320871 and row 11 of A320873, the second term is smaller than the third term. However, when this is not the case, then row n of the present sequence is the list of indices which gives the n-th variant of the square from the (ordered) set of 9 elements: e.g., (2, 7, 6, ...) means that the 2nd, 7th and 6th of the set of 9 numbers yield the first row of the square. For example, A320873(n) = A073519(a(n)), 1 <= n <= 9. - _M. F. Hasler_, Nov 04 2018
%H Eric Weisstein, <a href="http://mathworld.wolfram.com/MagicSquare.html">MathWorld: Magic Square</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Magic_square">Magic Square</a>
%H <a href="/index/Mag#magic">Index entries for sequences related to magic squares</a>
%e The first such magic square is
%e 2, 7, 6
%e 9, 5, 1
%e 4, 3, 8
%e From _M. F. Hasler_, Sep 23 2018: (Start)
%e The complete table reads:
%e [2, 7, 6, 9, 5, 1, 4, 3, 8]
%e [2, 9, 4, 7, 5, 3, 6, 1, 8]
%e [4, 3, 8, 9, 5, 1, 2, 7, 6]
%e [4, 9, 2, 3, 5, 7, 8, 1, 6]
%e [6, 1, 8, 7, 5, 3, 2, 9, 4]
%e [6, 7, 2, 1, 5, 9, 8, 3, 4]
%e [8, 1, 6, 3, 5, 7, 4, 9, 2]
%e [8, 3, 4, 1, 5, 9, 6, 7, 2] (End)
%t squares = {}; a=5; Do[m = {{a + b, a - b - c, a + c}, {a - b + c, a, a + b - c}, {a - c, a + b + c, a - b}}; If[ Unequal @@ Flatten[m] && And @@ (1 <= #1 <= 9 & ) /@ Flatten[m], AppendTo[ squares, m]], {b, -(a - 1), a - 1}, {c, -(a - 1), a - 1}]; Sort[ squares, FromDigits[ Flatten[#1] ] < FromDigits[ Flatten[#2] ] & ] // Flatten
%o (PARI) A217568=select(S->Set(S)==[1..9],concat(vector(9,a,vector(9,b,[a,b,15-a-b,20-2*a-b,5,2*a+b-10,a+b-5,10-b,10-a])))) \\ Could use that a = 2k, k = 1..4, and b is odd, within max(1,7-a)..min(9,13-a). - _M. F. Hasler_, Sep 23 2018
%Y Cf. A320871, A320872, A320873: inequivalent 3 X 3 magic squares of distinct integers, primes, consecutive primes.
%K easy,fini,nonn,full,tabf
%O 1,1
%A _Jean-François Alcover_, Oct 08 2012