cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A320872 For all possible 3 X 3 magic squares made of primes, in order of increasing magic sum, list the lexicographically smallest representative of each equivalence class (modulo symmetries of the square), as a row of the 9 elements (3 rows of 3 elements each).

Original entry on oeis.org

17, 89, 71, 113, 59, 5, 47, 29, 101, 41, 89, 83, 113, 71, 29, 59, 53, 101, 37, 79, 103, 139, 73, 7, 43, 67, 109, 29, 131, 107, 167, 89, 11, 71, 47, 149, 43, 127, 139, 199, 103, 7, 67, 79, 163, 37, 151, 139, 211, 109, 7, 79, 67, 181, 43, 181, 157, 241, 127, 13, 97, 73, 211
Offset: 1

Views

Author

M. F. Hasler, Oct 25 2018

Keywords

Comments

Magic squares of size 3 X 3 must be of the form
[ c-a-b c+b c+a ]
[ c+2a+b c c-2a-b ]
[ c-a c-b c+a+b ]
or any of the eight variants obtained by reflection(s) on any of the 4 symmetry axes of the square (horizontal, vertical and diagonals), which also produce the rotations by 90°, 180° and 270°. Of these eight variants the displayed one with a > b > 0 is the smallest one, with b > a > 0 the next larger one. (Strict inequalities since we require all elements to be distinct.) In this sequence we also restrict all entries to be primes, which may exclude one of the two possibilities (a > b or b > a).
The central elements, a(5 + 9k), k >= 0, or column 5 = T(n,5) if the sequence is seen as a table with rows of length 9, are (59, 71, 73, 89, 103, 109, 127, 127, 131, 137, 139, 149, 151, 157, 167, 167, 173, 179, 191, 191, ...). (Sequence not in OEIS.) If the primes are multiplied by three and duplicates are removed, one gets A268790 = list of magic sums of 3 X 3 magic squares of primes.

Examples

			The first four rows,
  17, 89, 71, 113, 59, 5, 47, 29, 101,
  41, 89, 83, 113, 71, 29, 59, 53, 101,
  37, 79, 103, 139, 73, 7, 43, 67, 109,
  29, 131, 107, 167, 89, 11, 71, 47, 149, (...)
correspond to the following magic squares:
   [ 17, 89, 71 ]    [ 41, 89,  83]    [ 37, 79, 103]    [ 29, 131, 107]
   [113, 59,  5 ]    [113, 71,  29]    [139, 73,  7 ]    [167,  89,  11]
   [ 47, 29, 101]    [ 59, 53, 101]    [ 43, 67, 109]    [ 71,  47, 149]
The seventh and eighth row are two inequivalent magic squares for the same magic sum 3*127:
   [ 43, 181, 157]         [ 73, 151, 157]
   [241, 127,  13]   and   [211, 127,  43] .  (The pair (13, 241) is replaced
   [ 97,  73, 211]         [ 97, 103, 181]     by (103, 151).)
		

Crossrefs

Cf. A320871: list of all inequivalent 3 X 3 magic squares (not only primes).
Cf. A320873: the first row consisting of a set of consecutive primes.
Cf. A268790: list of magic sums (= 3*(central term) = (row sum)/3), without duplicates.

Programs

  • PARI
    A320872_row(N=10,show=1,c=3)={forprime(c=c,, forstep(d=c-3,2,-2, isprime(c-d)&& isprime(c+d)&& forstep(b=max(2*d+3-c,2),d-2,2, d!=2*b&& isprime(c-2*d+b)&& isprime(c-b)&& isprime(c-d+b)&& isprime(c+d-b)&& isprime(c+2*d-b)&& isprime(c+b)&& (S=[c-d,c+b,c+d-b;c+2*d-b,c,c-2*d+b;c-d+b,c-b,c+d])&& !(show&&print(S))&& !N--&& return(S))))} \\ The 3rd (optional) argument allows computation of the list starting with the first row having a central element >= c or equivalently a magic sum >= 3c. The multiple isprime() can all be avoided using simply vecmin(apply(isprime,S=[...])), but this is significantly slower, which matters if used as proposed in A268790.