"""Independent determinant for the nonic binary highest layer of third degree one.""" from collections import Counter from itertools import combinations_with_replacement from math import ceil import numpy as np from flint import nmod_mat PRIME = 251 N = 4796 def binary_coefficients(): rows = 32 * ceil(N / 32) + 32 rng = np.random.Generator(np.random.PCG64(20261201)) # Keep the constant and linear terms in t of the product of nine (x+uy+vt). a = np.zeros((10, rows), dtype=np.int32) b = np.zeros_like(a) a[0] = 1 for r in range(1, 10): u, v = rng.integers(PRIME, size=(2, rows), dtype=np.int32) for d in range(r, 0, -1): b[d] = (b[d] + u * b[d - 1] + v * a[d - 1]) % PRIME a[d] = (a[d] + u * a[d - 1]) % PRIME return a, b def matrix(): a, b = binary_coefficients() result = np.empty((a.shape[1], N), dtype=np.uint8) start = 0 for degrees in combinations_with_replacement(range(10), 9): if sum(degrees) != 33: continue counts = Counter(degrees) labels = sorted(d for d in counts if d) if len(labels) < 2: continue monomials = {} for mark in labels: values = b[mark].copy() for d, count in counts.items(): for _ in range(count - (d == mark)): values = values * a[d] % PRIME monomials[mark] = values first = labels[0] for d in labels[1:]: result[:, start] = (first * monomials[d] - d * monomials[first]) % PRIME start += 1 if start != N: raise ArithmeticError(f"generated {start} columns, expected {N}") return result if __name__ == "__main__": values = matrix() minor = nmod_mat(values[:N].tolist(), PRIME) residue = int(minor.det()) print(f"size={N} first_row=0 prime={PRIME} determinant={residue}") if not residue: raise SystemExit(1)