%I
%S 1,48,368640,22295347200,932242784256000,144982397807493120000,
%T 221340898613898982195200000,21421302878528360015430942720000,
%U 59225618198555209770663470432256000000
%N Number of essentially different mostperfect pandiagonal magic squares of order 4n.
%C A mostperfect magic square is a pandiagonal magic square made of the numbers 1 to N^2, N = 4n, such that (1) each 2×2 subsquare, including wrapround, sums to S/n, where S = N(N^2 + 1)/2 is the magic sum; and (2) all pairs of integers distant N/2 along any diagonal (major or broken) are complementary, i.e., they sum to N^2 + 1.  _M. F. Hasler_, Oct 20 2018
%D K. Ollerenshaw and D. S. Bree, Mostperfect Pandiagonal Magic Squares: Their Construction and Enumeration, Inst. Math. Applic., SouthendonSea, England, 1998.
%D I. Stewart, Mostperfect magic squares, Sci. Amer., Nov. 1999, pp. 122123.
%H <a href="/index/Mag#magic">Index entries for sequences related to magic squares</a>
%F Let N = 4n = Product{g}[(p_g)^(s_g)] (p_g prime) and let W_v(n) = Sum{0 <= i <= v1}[(1)^{v+i}BINOM(v+1, i+1)*Product{g}BINOM(s_g+i, i)] then a(n) = 2^(N2)*(2n)!^2*Sum{0 <= v < Sum{g}s_g}[W_v(N)(W_v(N)+W_{v+1}(N))].
%F The above formula cannot be correct: For n = 0, the factorization is empty, then so is the sum in a(n), whence a(1) = 0 and not 1 as expected. For n = 1 => N = 4 = 2^2, Sum(s_g) = 2; the sum in a(n) is over v = 0 and v = 1, but W_0 = 0 (empty sum, 0 <= i <= 1), W_1 = sum_{0 <= i= <= 0}, (1)^(1) C(2,1)*C(2+0,0) = 2, W_2 = (1)^2 C(3,1)*C(2,0) + (1)^3 C(3,1)*C(3,1) = 6, so a(1) = 2^(2)*2!^2*(0 + (2)*(2+6)) = 256 and not 48, as expected.  _M. F. Hasler_, Oct 20 2018
%o (PARI) a(n)={my(s=factor(4*n)[,2],W=vector(vecsum(s)+1,V,sum(i=0,V2,(1)^(Vi1)*binomial(V,i+1)*prod(g=1,#s,binomial(s[g]+i,i)))));print(W);2^(4*n2)*(2*n)!^2*sum(V=1,#W1,(W[V]+W[V+1])*W[V])} \\ Implements the formula, where our W has indices V = v+1 = 1..Sum(s_g)+1 instead of 0..Sum(s_g), for technical reasons. DOES NOT PRODUCE THE TERMS, cf. FORMULA.  _M. F. Hasler_, Oct 20 2018
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_.
%E Formula and more terms from _Floor van Lamoen_, Aug 16 2001
