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.

Showing 1-2 of 2 results.

A280391 Number of 2 X 2 matrices with all elements in {0,...,n} with permanent = determinant * n.

Original entry on oeis.org

1, 12, 25, 57, 81, 141, 169, 259, 297, 413, 441, 621, 625, 825, 873, 1079, 1089, 1403, 1369, 1739, 1729, 2021, 2025, 2507, 2433, 2859, 2905, 3301, 3249, 4029, 3721, 4509, 4305, 4793, 4989, 5551, 5329, 6027, 6025, 6807, 6561, 7917, 7225, 8357, 8121, 8677, 8649, 9843, 9481, 10889
Offset: 0

Views

Author

Indranil Ghosh, Jan 02 2017

Keywords

Comments

All the values except a(1) are odd.
From Robert Israel, Jan 02 2017: (Start)
Number of solutions to (n+1)*x*y = (n-1)*z*w for x,y,z,w in [0..n].
a(n) >= (2n+1)^2, with equality if n+1 is an odd prime. (End)

Crossrefs

Cf. A280321 (Number of 2 X 2 matrices with all elements in {0,..,n} with permanent*n = determinant).
Cf. A015237 (Number of 2 X 2 matrices having all elements in {0..n} with determinant = permanent).
Cf. A016754 (Number of 2 X 2 matrices having all elements in {0..n} with determinant =2* permanent).
Cf. A280364 (Number of 2 X 2 matrices having all elements in {0..n} with determinant^n = permanent).

Programs

  • Maple
    g:= proc(r,n) if r = 0 then 2*n+1 else nops(select(t -> t <= n and r <= t*n, numtheory:-divisors(r))) fi end proc:
    f:= proc(n) local c;
        if n::even then (2*n+1)^2 + add(g((n+1)*c,n)*g((n-1)*c,n), c=1..n-1)
        else (2*n+1)^2 + add(g((n+1)/2*c,n) * g((n-1)/2*c,n), c=1..2*n-1)
        fi
    end proc:
    map(f, [$0..100]); # Robert Israel, Jan 02 2017
  • Mathematica
    g[r_, n_] := If[r == 0, 2n + 1, Length[Select[Divisors[r], # <= n && r <= # n&]]];
    f[n_] := If[EvenQ[n], (2n + 1)^2 + Sum[g[(n + 1)c, n] g[(n - 1)c, n], {c, 1, n - 1}], (2n + 1)^2 + Sum[g[(n + 1)/2 c, n] g[(n - 1)/2 c, n], {c, 1, 2n - 1}]];
    f /@ Range[0, 100] (* Jean-François Alcover, Jul 29 2020, after Robert Israel *)
  • Python
    def t(n):
        s=0
        for a in range(0,n+1):
            for b in range(0,n+1):
                for c in range(0,n+1):
                    for d in range(0,n+1):
                        if (a*d-b*c)*n==(a*d+b*c):
                            s+=1
        return s
    for i in range(0,201):
        print(t(i))

A280407 Number of 2 X 2 matrices with all elements in {-n,..,0,..,n} with permanent = determinant * n.

Original entry on oeis.org

1, 45, 81, 233, 289, 601, 625, 1113, 1153, 1785, 1681, 2761, 2401, 3577, 3505, 4665, 4225, 6185, 5329, 7673, 6945, 8601, 7921, 11033, 9665, 12265, 11793, 14089, 12769, 18073, 14641, 19945, 17281, 20121, 20593, 23961, 21025, 25417, 24177, 29177, 25921, 35449, 28561, 36233
Offset: 0

Views

Author

Indranil Ghosh, Jan 06 2017

Keywords

Examples

			For n = 2, few of the possible matrices are [-2,-2,0,0], [-2,-1,0,0], [-2,0,-2,0], [-2,0,-1,0], [-2,0,0,0], [-2,0,1,0], [-2,0,2,0], [1,0,0,0], [1,0,1,0], [1,0,2,0], [1,1,0,0], [1,2,0,0], [2,-2,0,0], [2,-1,0,0], [2,0,-2,0], .... There are 81 possibilities. Here each of the matrices 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 for n = 2, a(2)=81.
		

Crossrefs

Number of 2 X 2 matrices with all elements in {0,..,n}: A280391 (permanent = determinant * n), A280321 (determinant = permanent * n), A015237 (determinant = permanent) and A016754 (determinant = 2* permanent).

Programs

  • 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*d-b*c)*n==(a*d+b*c):
                            s+=1
        return s
    for i in range(0,156):
        print(t(i))
    
  • Python
    import numpy as np
    def a280417(N):
        if N > 0: yield 1
        if N > 1: yield 45
        if N <= 2: return
        prods = np.zeros(N * N, dtype=np.int32)
        prods[1] = 1 # prods[k] counts integer solutions to x*y = k with 1 <= x,y <= n
        for n in range(2, N):
            n_sq = n * n
            prods[n: n_sq: n] += 2
            prods[n_sq] += 1
            dx = (n + 1) // 2 if n % 2 else n + 1
            dy = (n - 1) // 2 if n % 2 else n - 1
            ad = prods[dx : n_sq : dx]
            bc = prods[dy : dy * ad.shape[0] + 1 : dy]
            yield (4 * n + 1) ** 2 + 8 * int(ad @ bc)
            # (4*n+1)**2 = solutions to a*d = b*c = 0 with -n <= a,b <= n.
            # ad @ bc = solutions to (n-1)*a*d = (n+1)*b*c > 0 with 1 <= a,b <= n.
            # Multiply by 8 to account for all consistent sign changes of a,b,c,d.
    print(list(a280417(44))) # David Radcliffe, May 22 2025

Formula

From David Radcliffe, May 22 2025: (Start)
a(n) = (4*n+1)^2 iff n=0 or n+1 is an odd prime, otherwise a(n) > (4*n+1)^2.
a(n) = 8 * A280391(n) - 8*(2*n+1)^2 + (4*n+1)^2 for n>1. (End)
Showing 1-2 of 2 results.