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.

A321685 Determinant of n X n matrix containing the first n^2 composites in increasing order.

Original entry on oeis.org

4, -12, 24, 0, -51, 0, 262, -126, 0, -1684, -47, 0, 480, 0, -854, 4349, 0, -2690, 10595, 0, 9074, 9680, 37734, -48262, 1200, -98037, 415504, -1687656, -1840201, 2208435, -24907680, -20571545, -2873052, 23511040, 255110496, 98995966, -17722962796, 3495484872
Offset: 1

Views

Author

Felix Fröhlich, Nov 17 2018

Keywords

Examples

			For n = 3: The matrix consisting of the initial 3^2 = 9 composites is
---        ---
|  4   6   8 |
|  9  10  12 |
| 14  15  16 |
---        ---
The determinant of the matrix is 24, so a(3) = 24.
		

Crossrefs

Programs

  • Mathematica
    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 *)
    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 *)
  • PARI
    composite(n) = my(i=0); forcomposite(c=1, , i++; if(i==n, return(c)))
    compositepi(n) = my(i=0); if(n==4, return(1), forcomposite(c=1, n, i++)); i
    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, "]")
    a(n) = matdet(eval(compositesquare(n)))
    
  • 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
    
  • Python
    from sympy import Array, Matrix, composite
    def A321685(n):
        return Matrix(Array((composite(i) for i in range(1,n**2+1)),(n,n))).det() # Chai Wah Wu, Sep 08 2020