%I #24 Jun 01 2022 01:54:05
%S 4,-12,24,0,-51,0,262,-126,0,-1684,-47,0,480,0,-854,4349,0,-2690,
%T 10595,0,9074,9680,37734,-48262,1200,-98037,415504,-1687656,-1840201,
%U 2208435,-24907680,-20571545,-2873052,23511040,255110496,98995966,-17722962796,3495484872
%N Determinant of n X n matrix containing the first n^2 composites in increasing order.
%H Chai Wah Wu, <a href="/A321685/b321685.txt">Table of n, a(n) for n = 1..100</a>
%H <a href="/index/De#determinants">Index entries for sequences related to determinants</a>
%H <a href="/index/Mat#MATRICES">Index entries for sequences related to matrices</a>
%e For n = 3: The matrix consisting of the initial 3^2 = 9 composites is
%e --- ---
%e | 4 6 8 |
%e | 9 10 12 |
%e | 14 15 16 |
%e --- ---
%e The determinant of the matrix is 24, so a(3) = 24.
%t composite[n_] := FixedPoint[n + PrimePi[#] + 1 &, n + PrimePi[n] + 1]; a[n_] := Det[ArrayReshape[Array[composite, n^2], {n, n}]]; Array[a, 40] (* _Amiram Eldar_, Nov 17 2018 after _Robert G. Wilson v_ at A002808 *)
%t Module[{nn=40,cmps},cmps=Select[Range[2nn^2],CompositeQ];Table[Det[ Partition[ Take[cmps,n^2],n]],{n,nn}]] (* _Harvey P. Dale_, Aug 10 2021 *)
%o (PARI) composite(n) = my(i=0); forcomposite(c=1, , i++; if(i==n, return(c)))
%o compositepi(n) = my(i=0); if(n==4, return(1), forcomposite(c=1, n, i++)); i
%o compositesquare(n) = if(n==1, return(Mat([4]))); my(s=""); forcomposite(c=1, composite(n^2), s=concat(s, Str(c)); if(compositepi(c)%n==0 && c!=composite(n^2), s=concat(s, "; "), if(c!=composite(n^2), s=concat(s, ", ")))); s=concat("[", s); s=concat(s, "]")
%o a(n) = matdet(eval(compositesquare(n)))
%o (PARI) a(n) = my (m=matrix(n,n), r=1, c=1); forcomposite(k=1,, m[r,c] = k; r++; if (r>n, r=1; c++; if (c>n, return (matdet(m))))) \\ _Rémy Sigrist_, Nov 17 2018
%o (Python)
%o from sympy import Array, Matrix, composite
%o def A321685(n):
%o return Matrix(Array((composite(i) for i in range(1,n**2+1)),(n,n))).det() # _Chai Wah Wu_, Sep 08 2020
%Y Cf. A067276, A118770.
%K easy,sign
%O 1,1
%A _Felix Fröhlich_, Nov 17 2018