A211031 Number of 2 X 2 matrices having all elements in {0,1,...,n} and determinant in the closed interval [-n,n].
1, 16, 69, 176, 375, 650, 1107, 1626, 2413, 3326, 4527, 5782, 7689, 9436, 11753, 14354, 17491, 20458, 24623, 28334, 33425, 38438, 44031, 49450, 57323, 64028, 71849, 80078, 89857, 98468, 110545, 120388, 133117, 145382, 158699, 172256
Offset: 0
Keywords
Links
- David Radcliffe, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
a = 0; b = n; z1 = 40; t[n_] := t[n] = Flatten[Table[w*z - x*y, {w, a, b}, {x, a, b}, {y, a, b}, {z, a, b}]] c[n_, k_] := c[n, k] = Count[t[n], k] c1[n_, m_] := c1[n, m] = Sum[c[n, k], {k, -n, m}] Table[c1[n, n], {n, 0, z1}] (* A211031 *)
-
Python
import numpy as np def A211031_gen(limit): yield 1 offset = limit + 1 size = offset * offset + 1 # a[offset+k] is the number of solutions to i*j = k with i,j in {0, 1, 2, ..., n} a = np.zeros(size, dtype=np.int64) a[offset] = 1 for n in range(1, offset): a[offset: offset + n*n: n] += 2 a[offset + n*n] += 1 lag = 2*n + 1 c = np.cumsum(a) c = c[lag:] - c[:-lag] a1 = a[n+1: -n] yield int(a1 @ c) print(list(A211031_gen(35))) # David Radcliffe, Aug 15 2025
Comments