OFFSET
1,2
COMMENTS
The matrix is formed by writing numbers 1 .. n^2 in zig-zag pattern as shown in examples below. Every other antidiagonal reads backwards from A069480.
Whereas each antidiagonal of A069480 begins with one more than a triangular number and ends with the next triangular number, here every other antidiagonal begins with one more than a triangular number and the next antidiagonal begins with a triangular number.
The trace of the matrix is the sequence A006003 (proved). - Stefano Spezia, Aug 07 2018
The matrix is defined by A[i,j] = (2 - i - j)*((i + j - 1) mod 2)+(j^2 + (2*i - 1)*j + i^2 - i)/2 + (j - 1)*(1 - 2*((i + j) mod 2)) if i + j <= n + 1 and A[i,j] = n^2 - ((4*n^2 + (- 4*j - 4*i + 6)*n + j^2 + (2*i - 3)*j + i^2 - 3*i + 2)/2 + (i + j - 2*n)*((2*n - i - j + 1) mod 2)) + 1 - (n - j)*(1 - 2*((i + j) mod 2)) if i + j > n + 1 (proved). - Stefano Spezia, Aug 11 2018
LINKS
Vaclav Kotesovec, Table of n, a(n) for n = 1..1450
Index entries for linear recurrences with constant coefficients, signature (0,-9,0,-36,0,-84,0,-126,0,-126,0,-84,0,-36,0,-9,0,-1).
FORMULA
From Vaclav Kotesovec, Jan 08 2019: (Start)
Recurrence: (5*n^16 - 176*n^15 + 2888*n^14 - 29332*n^13 + 206454*n^12 - 1068276*n^11 + 4205934*n^10 - 12861022*n^9 + 30891328*n^8 - 58524140*n^7 + 87229074*n^6 - 101275380*n^5 + 89823673*n^4 - 58824210*n^3 + 26795412*n^2 - 7559784*n + 985608)*a(n) = 8*(n^14 - 20*n^13 + 169*n^12 - 754*n^11 + 1630*n^10 + 564*n^9 - 15184*n^8 + 52244*n^7 - 109015*n^6 + 167071*n^5 - 202816*n^4 + 191592*n^3 - 125145*n^2 + 45333*n - 5832)*a(n-1) - (5*n^16 - 96*n^15 + 848*n^14 - 4580*n^13 + 16966*n^12 - 45892*n^11 + 94310*n^10 - 151266*n^9 + 192520*n^8 - 195196*n^7 + 155666*n^6 - 94052*n^5 + 39329*n^4 - 6798*n^3 - 4572*n^2 + 5400*n - 1944)*a(n-2).
a(n) ~ ((-1)^n - 3) * (cos(Pi*n/2) + sin(Pi*n/2)) * n^8 / 72. (End)
a(n) = -9*a(n-2) - 36*a(n-4) - 84*a(n-6) - 126*a(n-8) - 126*a(n-10) - 84*a(n-12) - 36*a(n-14) - 9*a(n-16) - a(n-18) for n > 18. - Stefano Spezia, Apr 25 2021, simplified by BoĊĦtjan Gec, Sep 21 2023
EXAMPLE
n=2, det=-2: {1 2 / 3 4 }
n=3, det=15: {1 2 6 / 3 5 7 / 4 8 9 }
n=4, det=-594: { 1 2 6 7 / 3 5 8 13 / 4 9 12 14 / 10 11 15 16 }
n=5, det=-5187: { 1 2 6 7 15 / 3 5 8 14 16 / 4 9 13 17 22 / 10 12 18 21 23 / 11 19 20 24 25 }
MATHEMATICA
a[i_, j_, n_] := If[i+j<=n+1, (2-i-j)*Mod[i+j-1, 2]+(j^2+(2*i-1)*j+i^2-i)/2+(j-1)*(1-2*Mod[i+j, 2]), n^2-((4*n^2+(-4*j-4*i+6)*n+j^2+(2*i-3)*j+i^2-3*i+2)/2+(i+j-2*n)*Mod[2*n-i-j+1, 2])+1-(n-j)*(1-2*Mod[i+j, 2])]; f[n_] := Det[ Table[a[i, j, n], {i, n}, {j, n}]]; Array[f, 27] (* Stefano Spezia, Aug 11 2018 *)
PROG
(PARI) A(i, j, n) = if (i + j <= n + 1, (2 - i - j)*((i + j - 1) % 2)+(j^2 + (2*i - 1)*j + i^2 - i)/2 + (j - 1)*(1 - 2*((i + j) % 2)), n^2 - ((4*n^2 + (- 4*j - 4*i + 6)*n + j^2 + (2*i - 3)*j + i^2 - 3*i + 2)/2 + (i + j - 2*n)*((2*n - i - j + 1) % 2)) + 1 - (n - j)*(1 - 2*((i + j) % 2)));
a(n) = matdet(matrix(n, n, i, j, A(i, j, n))); \\ Michel Marcus, Aug 11 2018
(MATLAB, FreeMat and Octave)
for(n=1:27)
A=zeros(n, n);
for(i=1:n)
for(j=1:n)
if(i+j<=n+1)
A(i, j)=(2-i-j)*mod(i+j-1, 2)+(j^2+(2*i-1)*j+i^2-i)/2+(j-1)*(1-2*mod(i+j, 2));
else
A(i, j)=n^2-((4*n^2+(-4*j-4*i+6)*n+j^2+(2*i-3)*j+i^2-3*i+2)/2+(i+j-2*n)*mod(2*n-i-j+1, 2))+1-(n-j)*(1-2*mod(i+j, 2));
end
end
end
fprintf('%d %0.f\n', n, det(A));
end # Stefano Spezia, Aug 12 2018
(GAP)
A078475 := function(k)
local i, j, n;
for n in [1 .. k] do
A:=NullMat(n, n);
for i in [1 .. n] do
for j in [1 .. n] do
if i+j<=n+1 then
A[i][j] := (2-i-j)*RemInt(i+j-1, 2)+(j^2+(2*i-1)*j+i^2-i)/2+(j-1)*(1-2*RemInt(i+j, 2));;
else
A[i][j] := n^2-((4*n^2+(-4*j-4*i+6)*n+j^2+(2*i-3)*j+i^2-3*i+2)/2+(i+j-2*n)*RemInt(2*n-i-j+1, 2))+1-(n-j)*(1-2*RemInt(i+j, 2));
fi;
od;
od;
Print(n, " ", Determinant(A), "\n");
od;
end;
A078475(27); # Stefano Spezia, Aug 12 2018
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Kit Vongmahadlek (kit119(AT)yahoo.com), Jan 03 2003
EXTENSIONS
Edited and extended by Robert G. Wilson v, May 08 2003
STATUS
approved