login
Number of 2 X 2 matrices with all terms in {-n,..,0,..,n} and (sum of terms) = determinant.
2

%I #14 Feb 12 2025 18:45:22

%S 1,31,111,271,479,831,1167,1711,2239,2975,3631,4687,5407,6655,7759,

%T 9135,10367,12127,13231,15375,16991,19135,20879,23471,25215,27999,

%U 30319,33167,35359,39167,41039,44975,47615,50975,54511,58767,61791,66239,69391

%N Number of 2 X 2 matrices with all terms in {-n,..,0,..,n} and (sum of terms) = determinant.

%H Indranil Ghosh, <a href="/A281194/b281194.txt">Table of n, a(n) for n = 0..186</a>

%e For n = 3, few of the possible matrices are [-3,-3,-3,0], [-3,-3,-1,1], [-3,-3,1,2], [-3,-3,3,3], [-3,-2,-1,1], [-3,-2,3,2], [-3,-1,-3,1], [-3,-1,-2,1], [-3,-1,-1,1], [-3,-1,0,1], [-3,-1,1,1], [-3,-1,2,1], [-3,-1,3,1], [-3,0,-1,1], [2,0,0,2], [2,0,1,3], [2,1,-3,-3], [2,1,-2,-1], [2,1,-1,1], [3,3,0,3],...There are 271 possibilities.

%e Here each of the matrices M is defined as M = [a,b;c,d] where a = M[1][1], b = M[1][2], c = M[2][1], d = M[2][2]. So, a(3) = 271.

%o (Python)

%o def t(n):

%o s=0

%o for a in range(-n, n+1):

%o for b in range(-n, n+1):

%o for c in range(-n, n+1):

%o for d in range(-n, n+1):

%o if (a+b+c+d)==(a*d-b*c):

%o s+=1

%o return s

%o for i in range(0, 187):

%o print(f"{i} {t(i)}")

%o (PARI) a(n)=sum(a=-n,n, sum(d=-n,n, my(t=a*d+a+d); sum(b=-n,n, if(b==-1, if(t==-1, 2*n+1, 0), my(c=(t-b)/(b+1)); denominator(c)==1 && c<=n && c>=-n)))) \\ _Charles R Greathouse IV_, Jan 17 2017

%Y Cf. A280588, A280934.

%K nonn,changed

%O 0,2

%A _Indranil Ghosh_, Jan 17 2017