A367133 Rank of the n X n matrix whose terms are the n^2 values of isprime(x) from 1 to n^2.
0, 2, 3, 3, 5, 3, 7, 5, 7, 5, 11, 5, 11, 7, 9, 9, 16, 7, 19, 9, 13, 11, 23, 9, 20, 13, 19, 13, 29, 9, 31, 17, 21, 17, 25, 13, 37, 19, 25, 17, 41, 13, 43, 21, 25, 23, 47, 17, 43, 21, 33, 25, 53, 19, 41, 25, 37, 29, 59, 17, 61, 31, 37, 33, 49, 21, 67, 33, 45, 25
Offset: 1
Keywords
Examples
For n=4, we consider the first n^2=16 terms of the characteristic function of primes (A010051): (0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0). These terms form a matrix by arranging them in 4 consecutive subsequences of 4 terms each: 0, 1, 1, 0; 1, 0, 1, 0; 0, 0, 1, 0; 1, 0, 0, 0; and the largest square submatrix with a nonzero determinant within this matrix is of dimension 3. Therefore, the rank is 3, and so a(4)=3.
Programs
-
Maple
f:= proc(n) local i; LinearAlgebra:-Rank(Matrix(n,n,[seq(`if`(isprime(i),1,0),i=1..n^2)])) end proc: map(f, [$1..100]); # Robert Israel, Nov 11 2023
-
Mathematica
mat[n_,i_,j_]:=Boole[PrimeQ[(i-1)*n+j]]; a[n_]:=MatrixRank@Table[mat[n,i,j],{i,1,n},{j,1,n}]; Table[a[n],{n,1,70}]
-
PARI
a(n) = matrank(matrix(n, n, i, j, isprime((i-1)*n+j))); \\ Michel Marcus, Nov 07 2023
-
Python
from sympy import Matrix, isprime def A367133(n): return Matrix(n,n,[int(isprime(i)) for i in range(1,n**2+1)]).rank() # Chai Wah Wu, Nov 16 2023
Comments