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.

A279018 Number of 2 X 2 matrices having entries in {-n,...,0,..,n} and permanent=trace with no entry repeated.

Original entry on oeis.org

0, 0, 8, 24, 56, 100, 156, 236, 320, 408, 540, 692, 844, 1044, 1228, 1368, 1592, 1884, 2180, 2500, 2764, 2996, 3356, 3756, 4080, 4456, 4884, 5276, 5740, 6252, 6740, 7316, 7868, 8340, 8860, 9352, 9896, 10628, 11324
Offset: 0

Views

Author

Indranil Ghosh, Dec 03 2016

Keywords

Crossrefs

Cf. A211145 (wherein the entries can be repeated).

Programs

  • Mathematica
    f[n_] := f[n] = Block[{a, b, c, d, s = 0}, a = -n; While[a < n +1, b = -n; While[b < n +1, c = -n; While[c < n +1, d = -n; While[d < n +1, If[ a != b && a != c && a != d && b != c && b != d && c != d && a*d + b*c == a + d, s++]; d++]; c++]; b++]; a++]; s]; Array[f, 40, 0] (* Robert G. Wilson v, Dec 03 2016 *)
  • 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  and a!=d and b!=d and c!=a and c!=b and c!=d):
                            if (a*d+b*c)==a+d:
                                s+=1
        return s
    for i in range(0,151):
        print(i, t(i))