login
A320876
Lexicographically first 6 X 6 pandiagonal magic square made of consecutive primes with the smallest magic constant (930).
4
67, 139, 241, 73, 199, 211, 193, 233, 97, 167, 103, 137, 71, 113, 191, 131, 227, 197, 251, 181, 89, 229, 101, 79, 109, 157, 163, 151, 127, 223, 239, 107, 149, 179, 173, 83
OFFSET
1,1
COMMENTS
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.
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, ...)
There exist non-pandiagonal 6 X 6 magic squares composed of consecutive primes with smaller magic constant, the smallest being A073520(6) = 484.
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).
REFERENCES
Allan W. Johnson, Jr., Journal of Recreational Mathematics, vol. 23:3, 1991, pp. 190-191.
Clifford A. Pickover, The Zen of Magic Squares, Circles and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002.
EXAMPLE
The magic square is
[ 67 139 241 73 199 211]
[193 233 97 167 103 137]
[ 71 113 191 131 227 197]
[251 181 89 229 101 79]
[109 157 163 151 127 223]
[239 107 149 179 173 83]
PROG
(PARI) /* the following transformation operators for matrices, together with transposition, allow the production of all variants of a (pandiagonal) magic square */
REV(M)=matconcat(Vecrev(M)) \\ reverse the order of columns of M
FLIP(M)=matconcat(Colrev(M)) \\ reverse the order of row of M
ROT(M, k=1)=matconcat([M[, k+1..#M], M[, 1..k]]) \\ rotate left by k (default: 1) columns
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.
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.
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
M. F. Hasler, Oct 22 2018
STATUS
approved