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).

This page as a plain text file.
%I A320872 #24 Apr 17 2022 03:54:45
%S A320872 17,89,71,113,59,5,47,29,101,41,89,83,113,71,29,59,53,101,37,79,103,
%T A320872 139,73,7,43,67,109,29,131,107,167,89,11,71,47,149,43,127,139,199,103,
%U A320872 7,67,79,163,37,151,139,211,109,7,79,67,181,43,181,157,241,127,13,97,73,211
%N 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).
%C A320872 Magic squares of size 3 X 3 must be of the form
%C A320872    [ c-a-b    c+b    c+a   ]
%C A320872    [ c+2a+b    c    c-2a-b ]
%C A320872    [  c-a     c-b   c+a+b  ]
%C A320872 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).
%C A320872 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.
%H A320872 <a href="/index/Mag#magic">Index entries for sequences related to magic squares</a>
%e A320872 The first four rows,
%e A320872   17, 89, 71, 113, 59, 5, 47, 29, 101,
%e A320872   41, 89, 83, 113, 71, 29, 59, 53, 101,
%e A320872   37, 79, 103, 139, 73, 7, 43, 67, 109,
%e A320872   29, 131, 107, 167, 89, 11, 71, 47, 149, (...)
%e A320872 correspond to the following magic squares:
%e A320872    [ 17, 89, 71 ]    [ 41, 89,  83]    [ 37, 79, 103]    [ 29, 131, 107]
%e A320872    [113, 59,  5 ]    [113, 71,  29]    [139, 73,  7 ]    [167,  89,  11]
%e A320872    [ 47, 29, 101]    [ 59, 53, 101]    [ 43, 67, 109]    [ 71,  47, 149]
%e A320872 The seventh and eighth row are two inequivalent magic squares for the same magic sum 3*127:
%e A320872    [ 43, 181, 157]         [ 73, 151, 157]
%e A320872    [241, 127,  13]   and   [211, 127,  43] .  (The pair (13, 241) is replaced
%e A320872    [ 97,  73, 211]         [ 97, 103, 181]     by (103, 151).)
%o A320872 (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.
%Y A320872 Cf. A320871: list of all inequivalent 3 X 3 magic squares (not only primes).
%Y A320872 Cf. A320873: the first row consisting of a set of consecutive primes.
%Y A320872 Cf. A268790: list of magic sums (= 3*(central term) = (row sum)/3), without duplicates.
%K A320872 nonn,tabf
%O A320872 1,1
%A A320872 _M. F. Hasler_, Oct 25 2018