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.

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

Original entry on oeis.org

1, 31, 111, 271, 479, 831, 1167, 1711, 2239, 2975, 3631, 4687, 5407, 6655, 7759, 9135, 10367, 12127, 13231, 15375, 16991, 19135, 20879, 23471, 25215, 27999, 30319, 33167, 35359, 39167, 41039, 44975, 47615, 50975, 54511, 58767, 61791, 66239, 69391
Offset: 0

Views

Author

Indranil Ghosh, Jan 17 2017

Keywords

Examples

			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.
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.
		

Crossrefs

Programs

  • 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
  • Python
    def t(n):
        s=0
        for a in range(-n, n+1):
            for b in range(-n, n+1):
                for c in range(-n, n+1):
                    for d in range(-n, n+1):
                        if (a+b+c+d)==(a*d-b*c):
                            s+=1
        return s
    for i in range(0, 187):
        print(f"{i} {t(i)}")