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.

A211031 Number of 2 X 2 matrices having all elements in {0,1,...,n} and determinant in the closed interval [-n,n].

This page as a plain text file.
%I A211031 #22 Aug 16 2025 03:29:38
%S A211031 1,16,69,176,375,650,1107,1626,2413,3326,4527,5782,7689,9436,11753,
%T A211031 14354,17491,20458,24623,28334,33425,38438,44031,49450,57323,64028,
%U A211031 71849,80078,89857,98468,110545,120388,133117,145382,158699,172256
%N A211031 Number of 2 X 2 matrices having all elements in {0,1,...,n} and determinant in the closed interval [-n,n].
%C A211031 For a guide to related sequences, see A210000.
%H A211031 David Radcliffe, <a href="/A211031/b211031.txt">Table of n, a(n) for n = 0..10000</a>
%t A211031 a = 0; b = n; z1 = 40;
%t A211031 t[n_] := t[n] = Flatten[Table[w*z - x*y, {w, a, b}, {x, a, b}, {y, a, b}, {z, a, b}]]
%t A211031 c[n_, k_] := c[n, k] = Count[t[n], k]
%t A211031 c1[n_, m_] := c1[n, m] = Sum[c[n, k], {k, -n, m}]
%t A211031 Table[c1[n, n], {n, 0, z1}]  (* A211031 *)
%o A211031 (Python)
%o A211031 import numpy as np
%o A211031 def A211031_gen(limit):
%o A211031     yield 1
%o A211031     offset = limit + 1
%o A211031     size = offset * offset + 1
%o A211031     # a[offset+k] is the number of solutions to i*j = k with i,j in {0, 1, 2, ..., n}
%o A211031     a = np.zeros(size, dtype=np.int64)
%o A211031     a[offset] = 1
%o A211031     for n in range(1, offset):
%o A211031         a[offset: offset + n*n: n] += 2
%o A211031         a[offset + n*n] += 1
%o A211031         lag = 2*n + 1
%o A211031         c = np.cumsum(a)
%o A211031         c = c[lag:] - c[:-lag]
%o A211031         a1 = a[n+1: -n]
%o A211031         yield int(a1 @ c)
%o A211031 print(list(A211031_gen(35))) # _David Radcliffe_, Aug 15 2025
%Y A211031 Cf. A210000, A211032.
%K A211031 nonn
%O A211031 0,2
%A A211031 _Clark Kimberling_, Mar 30 2012