login
Lexicographically first 6 X 6 pandiagonal magic square made of consecutive primes with the smallest magic constant (930).
4

%I #10 Apr 17 2022 03:55:02

%S 67,139,241,73,199,211,193,233,97,167,103,137,71,113,191,131,227,197,

%T 251,181,89,229,101,79,109,157,163,151,127,223,239,107,149,179,173,83

%N Lexicographically first 6 X 6 pandiagonal magic square made of consecutive primes with the smallest magic constant (930).

%C The same 6 X 6 terms are given in increasing order in sequence A073523. But giving them in increasing order does not contain more information as the smallest of them or magic constant (= sum) itself, which uniquely determines the sequence of primes since they have to be consecutive and their sum is equal to 6 times the magic constant. The present sequence gives the full information about the magic square.

%C A pandiagonal magic square allows rotations (rather than arbitrary cyclic permutations) of columns or rows, as well as reflection on the 4 symmetry axes of the square. Considering all these variants of this square, there is none with elements coming earlier than (67, 139, ...)

%C There exist non-pandiagonal 6 X 6 magic squares composed of consecutive primes with smaller magic constant, the smallest being A073520(6) = 484.

%C Pandiagonal means that not only the 2 main diagonals, but all other 10 diagonals also have the same sum, Sum_{i=1..6} A[i,M6(k +/- i)] = 930 for k = 1, ..., 6 and M6(x) = y in {1, ..., 6} such that y == x (mod 6).

%D Allan W. Johnson, Jr., Journal of Recreational Mathematics, vol. 23:3, 1991, pp. 190-191.

%D Clifford A. Pickover, The Zen of Magic Squares, Circles and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002.

%H Harvey Heinz, <a href="http://www.magic-squares.net/primesqr.htm">Prime Magic Squares</a>

%H <a href="/index/Mag#magic">Index entries for sequences related to magic squares</a>

%e The magic square is

%e [ 67 139 241 73 199 211]

%e [193 233 97 167 103 137]

%e [ 71 113 191 131 227 197]

%e [251 181 89 229 101 79]

%e [109 157 163 151 127 223]

%e [239 107 149 179 173 83]

%o (PARI) /* the following transformation operators for matrices, together with transposition, allow the production of all variants of a (pandiagonal) magic square */

%o REV(M)=matconcat(Vecrev(M)) \\ reverse the order of columns of M

%o FLIP(M)=matconcat(Colrev(M)) \\ reverse the order of row of M

%o ROT(M,k=1)=matconcat([M[,k+1..#M],M[,1..k]]) \\ rotate left by k (default: 1) columns

%o ALL(M)=Set(concat(apply(M->vector(#M,k,ROT(M,k)),[M,M~,REV(M),REV(M~),FLIP(M),FLIP(M~)]))) \\ PARI orders the set according to the (first) columns of the matrices, so one must take the transpose to get them ordered according to elements of the first row.

%o MagicPrimes(S=930,n=6,P=[nextprime(S\n)])={S=n*S-P[1];for(i=1,-1+n*=n,S-=if(S>(n-i)*P[1],P=concat(P,nextprime(P[#P]+1));P[#P],P=concat(precprime(P[1]-1),P);P[1]));if(S,-P,P)} \\ The vector of n^2 primes whose sum is n*S (= A073523 for default values), or a negative vector of "best approximation" if there is no exact solution.

%Y Cf. A073519, A073520, A073521, A073522.

%K nonn,fini,full

%O 1,1

%A _M. F. Hasler_, Oct 22 2018