WorksMathematics
Exact p-adic Valuations of Algebraic Binomial Coefficients and Transfer-Operator Enumeration of Separated Permutations: Resolutions of Open Problems in OEIS A387569, A392059, and A179967
Abstract
We resolve three open problems in the On-Line Encyclopedia of Integer Sequences (OEIS) and establish two broader generalizations. First, for n >= 1, let A387569(n) denote the least positive integer y for which there exists an integer x with binom(x + iy, n) in Z[i]. Using local completions, we prove that primes p ≡ 1 (mod 4) never divide A387569(n), prove via the Chinese Remainder Theorem that binom(x + iy, n) is in Z[i] for some integer x if and only if A387569(n) divides y, and derive an explicit prime-power formula extending the known table beyond n = 23. More generally, for any imaginary quadratic ring of integers O_K (including non-UFDs such as Z[sqrt(-5)]), we prove by local valuation decoupling and the Chinese Remainder Theorem that unramified split rational primes never divide the minimal existential shift, while showing via Q(sqrt(-3)) that 2y-periodicity fails in general and proving an explicit universal period bound via Chu–Vandermonde. Second, for A392059(n), we characterize universal integrality over all integers x, establish the polynomial translation identity binom(x + A392059(n)i, c) ≡ binom(x + 2^floor(log_2 n), c) (mod 1+i) for every 0 <= c <= n, disprove the OEIS congruence conjecture for all n >= 1 using the explicit witness x(n) = n - 2^floor(log_2 n), and prove that the minimal period modulo (1+i) is 2*A392059(n). Third, we construct an explicit finite quotient transfer operator resolving Manyama's (2026) conjectures on OEIS A179967 (permutations of [2n+9] with |p(j)-p(j-1)| > n), proving pure-integer Stage 1 prefix-graph orbit contraction, bijective Stage 2–3 transition weights, direct enumeration of all pre-bulk terms 0 <= n <= 7, Krylov annihilator minimality, and exact closed forms across 2 <= k <= 9 (OEIS A322255).
Introduction
The arithmetic of integer-valued polynomials over algebraic number rings—initiated by Pólya and Ostrowski and generalized via -orderings by Bhargava [1, 2]—motivates integrality questions for binomial polynomials along affine slices. For and (), two dual problems appear in the OEIS:
Existential integrality (OEIS A387569 [10]): Find the least with for some . Direct search previously reached only , leaving periodicity in , the absence of prime factors , and a general formula open.
Version 2.6 Final (joint AI–human collaborative edition incorporating Stage 1 prefix-graph automorphism proofs, explicit Stage 2–3 combinatorial weight identities, Vandermonde period bounds, exact 2-adic factorial valuations, and vectorized meet-in-the-middle enumeration through ). Primary derivations, transfer-operator constructions, verification code, and manuscript synthesis by Google Gemini (Gemini 4 Carbon); independent adversarial auditing, the periodicity counterexample, and proof-completeness critiques by OpenAI ChatGPT; confidential prompting architecture and workflow orchestration by Seon-Woo Hong; see Section 5. (2) Universal integrality and congruence (OEIS A392059 [11]): For
it was conjectured in [11] that is the minimal satisfying for all .
§ 1.3 and § 2 resolve both problems completely and extend split-prime invisibility to arbitrary imaginary quadratic Dedekind domains . Section 4 resolves Manyama’s (2026) conjectures on OEIS A179967 [8] enumerating permutations of with , together with (, diagonals of OEIS A322255 [9]).
Notation and Binomial Conventions
Lowercase denote rational primes, and denotes the -adic valuation on (). For an algebraic number field with ring of integers , gothic letters denote nonzero prime ideals of , with normalized discrete valuation on . In , inert has with on , while with and . For any -algebra and , set (), , and (). Then for all ( for ; for ), and
holds in .
Related Work
For classical binomial rows (), Rowland [12] gave a -regular matrix product for , generalized by Chand [3] to Fibonomial and -nomial coefficients. Whereas those works count valuations across , A387569 and A392059 fix and vary along , governed by prime splitting in . In combinatorics, maximizing is the anti-bandwidth (separation number) problem in frequency assignment [4], scheduling [5], and graph layouts [7]; our transfer operator yields exact rational generating functions and exponential growth rates on paths .
Local-to-Global Valuations for OEIS A387569 and Dedekind Domains
Lemma 2.1 (Split primes). If splits in as , then and for all and .
Proof. By Hensel’s lemma, has roots , inducing () and (). Thus maps to . By Mahler’s theorem [6], is continuous on and maps the dense set into , so .
Lemma 2.2 (Inert primes). Let be prime and with . For and ,
depends only on and , with (attained whenever ) and (attained at ).
Proof. In , , so , yielding (2). Any consecutive integers contain between and multiples of ; gives multiples in for all , while gives multiples in .
Lemma 2.3 (Ramified norm resonance). Let . For (, odd) and ,
Hence depends only on and (independently of ), with
achieved whenever .
Proof. Since and , . If , ; if , ; if , writing ( odd) gives , so , proving (3). For , () and , attaining each upper bound simultaneously on . □
Theorem 2.4 (Complete resolution of OEIS A387569). For , set
where and . Then:
(i) For fixed and , is periodic in with period dividing .
(ii) For any , there exists with if and only if . In particular, , and satisfies whenever .
Proof. Since and split primes satisfy by Lemma 2.1 while primes do not divide , membership () is equivalent to
By Lemmas 2.2–2.3, these depend on only modulo and , whose least common multiple divides , proving (i).
For (ii), is trivial. For , increases by per step, and is strictly increasing. Necessity: If , either () or for some inert (), leaving (6) unsolvable. Sufficiency: If , then (attained on independently of odd factors of ) and (attained on ). By pairwise coprimality and the Chinese Remainder Theorem, a simultaneous solution exists; explicitly, satisfies both congruences simultaneously, giving . □
Theorem 2.5 (Extension to imaginary quadratic Dedekind domains). Let be squarefree, , ( if ; if ), and . Even when (non-UFD), no rational prime splitting completely as () ever divides .
| 24 | 2,422,728 | 33 | 75,104,568 | 42 | 75,104,568 |
| 25 | 1,211,364 | 34 | 75,104,568 | 43 | 3,229,496,424 |
| 26 | 2,422,728 | 35 | 75,104,568 | 44 | 6,458,992,848 |
| 27 | 3,634,092 | 36 | 450,627,408 | 45 | 9,688,489,272 |
| 28 | 2,422,728 | 37 | 75,104,568 | 46 | 3,229,496,424 |
| 29 | 1,211,364 | 38 | 75,104,568 | 47 | 151,786,331,928 |
| 30 | 2,422,728 | 39 | 75,104,568 | 48 | 303,572,663,856 |
| 31 | 37,552,284 | 40 | 150,209,136 | 49 | 1,062,504,323,496 |
| 32 | 300,418,272 | 41 | 75,104,568 | 50 | 151,786,331,928 |
Table 1. Exact values of for from (5).
Proof. At any split prime (), is a DVR with , so via Hensel lifting; Mahler’s theorem gives for all .
Suppose a split prime divides , set , and fix with . For each non-split rational prime (, ), let be the unique prime ideal above and set . We find preserving :
inert: is an integral -basis of , so ; since , works.
odd and ramified (): If (), , so works. If (), and , giving . Choosing with () preserves on every factor, hence preserves .
ramified (, ): Here . If , parity gives . If and ( odd), then gives , whereas (, odd) gives and independently of ; thus works.
Since local integrality at depends on only modulo and are pairwise coprime, CRT yields with for all non-split , giving and contradicting . □
Remark 2.6 (Failure of -periodicity in general and explicit universal period bound). Unlike Theorem 2.4(i) for , the period in need not divide in general: in () at , (), whereas , despite . Instead, for every and , integrality is periodic across all with period dividing . Indeed, for and , Chu–Vandermonde gives . Each term () is locally integral at split primes (as in Theorem 2.5) and at all primes (which do not divide ), since . At each non-split prime (, ), for gives and (as ), while implies ; thus for all , so . Full-period CRT verification (Appendix A) confirms in ().
Universal Integrality and Disproof of the Conjecture in OEIS A392059
Lemma 3.1 (Chu–Vandermonde reduction). For any additive subgroup , , and , holds for all if and only if for every .
Proof. Writing under § 1.1, for all gives sufficiency; conversely, iterated forward differences satisfy for . □
Theorem 3.2 (Characterization and correction of OEIS A392059). Let be given by (1) for , and . Under § 1.1:
(i) For , for all if and only if .
(ii) For , every , and every (including and ),
(iii) For every , and give , disproving the conjecture in OEIS A392059 for all .
(iv) For every , the minimal with and for all is .
Proof. By Lemma 3.1 () and Lemma 2.1, universal integrality holds iff is locally integral at and odd inert for all . For inert and , , which is for when , and at when . At (), :
If (), for , giving for all .
If , gives ( for , and at ); for (), contributes by Lemma 2.3, giving .
If , setting gives numerator valuation and denominator valuation (via ), hence .
This proves (i). When (), for . Reducing modulo gives . In , holds for all ; reducing modulo in gives , equating coefficients of to prove (7). Setting and gives , proving (iii); requiring forces , proving (iv). □
Self-Contained Transfer-Operator Theory for Separated Permutations
Let be the graph on with edges for ; is twice the number of undirected Hamiltonian paths in .
Proposition 4.1 (Half-graph decomposition). For and , partition into five disjoint sets:
with , , , . Set and . Then , , and are independent sets in ; no edge joins to ,
whereas between and , and ; furthermore, , , and .
Proof. Internal differences in are and in are . For , (), and ( with ). For and , , which holds if or , and gives for .
Every undirected Hamiltonian path of () has two degree-1 global endpoints partitioned across , built uniquely in three stages: Stage 1 selects all edges of incident to (into ) and designates whichever global endpoints (0, 1, or 2) lie in ; Stage 2 processes for , adding to the active -pool, saturating , and designating any global endpoints in ; Stage 3 designates any remaining global endpoints on , saturates against the surviving active -pool, and multiplies by 2.
Lemma 4.2 (Intertwining quotient). For an active -pool with untouched vertices, twin-paired -to- segments, and boundary-tethered ends (), the internal bulk block on satisfies for . Moreover, all bulk and Stage 3 operators intertwine , collapsing onto .
Proof. After sends , -weighted transitions from sum to , independent of . Similarly, single-slot and pair-slot extractions without yield and , with terminal weight at .
Definition 4.3 (Quotiented state tuple). A non-closed cut configuration is given by (plus terminal state CLOSED when is pre-saturated in Stage 1), where is the -quotiented -capacity; counts -to- bridges; counts -to-endpoint segments; counts untouched -vertices; counts -to- arches; counts -to-endpoint segments; and counts placed global endpoints.
Lemma 4.4 (Degree-balance invariant and finiteness). Setting and , any completable state satisfies
Hence the reachable state set is finite for every $k\ge2.
Proof. If () denote remaining endpoints placed on future , future , and , Stage 3 degree equality requires , so , yielding (8). Since , (8) bounds all coordinates of .
Lemma 4.5 (Exactness of Stage 1 staircase contraction and orbit double-counting). Process across . At step , define the active left pool ( entering before for , untouched or as a global endpoint), the active right pool of size , and the frozen pool . Classify each labeled partial forest after by the 13-tuple
*where count degree-0 vertices in , the next nine coordinates count open paths by the unordered pool-pair of their two ends in ( forbidden), and . Let be the number of labeled forests in class after . Then:
(a) For , moving from into partitions by the role of among six disjoint roles (saturated degree-2, counted by , or role counts ). For every and , divides in , and the exact labeled count with in role is .
(b) At , , so , and projects losslessly onto the Stage 1 initial vector on Definition 4.3.
Proof. Let denote the Stage 1 processed prefix graph at step on vertex set , whose edges are the Stage 1 incidences . By Proposition 4.1, is an independent set, every and every processed () is adjacent in to every , and every has the identical neighborhood in . Extending each permutation in by the identity outside therefore yields graph automorphisms of the processed prefix graph (though not of for , since future is non-adjacent to ), preserving . Counting pairs where has role in gives summing over first, and by transitivity of summing over first, proving (a). At , forces all five -coordinates to vanish and , mapping via Lemma 4.2 directly onto Definition 4.3.
Proposition 4.6 (Bijective exactness of Stage 2–3 transition multiplicities). Every undirected Hamiltonian path of () corresponds to a unique trajectory of labeled partial forests across Stages 1–3 without double-counting, and Lemma 4.5 yields with exact rules on ():
-insertion : enters as internal (, wt 1) or, if , as endpoint (, , wt 1).
-saturation : Complete bipartiteness makes valid completions invariant under . Cycle-freeness forbids joining twin ends of an -arch, picking an untouched -vertex twice, or joining two -ends unless . Applying from Lemma 4.2:
Endpoint () picks 1 -slot: from in ways ; from bridges in ways ; or (wt 1).
Internal picks 2 -slots: both from in ways or one from and one from in ways, giving ways ; two bridges in ways ; one bridge and one -end in ways ; or (wt 1).
Stage 3 closure : Saturating open vertices of in canonical order avoids double-counting: applies ; consumes 1 -slot ( or ways, or closes at ); the first end of turns its partner into (endpoint: 1 way; joined to : ways), ( ways), or ( ways); and becomes (1 or ways), joins another bridge ( ways, avoiding its own -end), or joins in ways, multiplying closed spanning paths by 2.
Proof. Each spanning path restricts uniquely to every prefix; is a Hamiltonian path iff degrees are 2 (except 2 endpoints of degree 1), no step closes a cycle, and the final edge joins the two endpoint components. Lemma 4.5, items (1)–(3), and Lemma 4.2 partition all valid local selections bijectively.
Example 4.7 (Worked 12-state system for , A129534). For (), has states: [, ], [4, 2], [1, 4], [1, 2], [1, 4], [1, 2], [1, ?], [1, 2], [1, 0], [1, 2], [3, ?], and [3, 2]. Transitions () and (, ) yield the Jordan chains while the mode cancels on , giving () and proving ().
Theorem 4.8 (Resolution of OEIS A179967 and family A322255). For , , and has generating function
for all , and closed form for all :
Across , the minimal recurrence operator for is , yielding the exact closed forms in Table 3.
Proof. By Lemma 4.5 and Proposition 4.6, for and , on . For and , Cayley–Hamilton implies . Appendix A verifies Krylov annihilation across $0\le m\le 194$ (and non-vanishing if any root factor is omitted), proving for all . All eight pre-bulk values are computed directly without transfer operators (subset DP for and vectorized meet-in-the-middle for , i.e., $N=19,21,23). Combining with yields zero coefficients at in , proving (9) and (10). Analogous Krylov verification for (cross-checked against raw labeled Stage 1 enumeration for and subset DP across , ) establishes Table 3.
| OEIS / Seq. | Minimal recurrence roots | Exact proved formula for all | ||
| 2 | Const (2) | 1 | 2 | |
| 3 | A129534 | 12 | ||
| 4 | A179962 | 31 | ||
| 5 | A179963 | 55 | ||
| 6 | A179964 | 79 | ||
| 7 | A179965 | 114 | ||
| 8 | A179966 | 147 | ||
| 9 | A179967 | 193 | See closed form (10) |
Table 3. Reachable dimensions , minimal recurrence roots of , and exact closed forms for across (diagonals of OEIS A322255).
| A179967() | |
| 15 | 8,360,092,086,071,998,742,691,840 |
| 16 | 170,567,948,261,566,724,975,493,120 |
| 17 | 3,478,446,688,452,290,960,163,471,360 |
| 18 | 70,906,470,173,375,431,565,055,098,880 |
| 19 | 1,444,804,224,341,790,235,429,754,634,240 |
| 20 | 29,428,214,824,670,023,287,111,753,400,320 |
Table 2. Values of A179967() for beyond the main OEIS display (), confirming agreement between , (10), and Manyamā’s table [8].
| Statement | Infinite-Range Proof Mechanism | Finite-Range / Annihilator Check in Appendix A |
| Lemmas 2.1–2.3 | Hensel’s lemma; Mahler [6] | binom_theta local valuation checks |
| Theorem 2.4 (A387569) | Dedekind ; CRT | Suff. (), prime-del (), min-y () |
| Theorem 2.5, Rem. 2.6 | DVR completion ; CRT | Full-period CRT (); |
| Lemma 3.1, Theorem 3.2 | Chu–Vandermonde; Frobenius | A392059_def (; for ) |
| Lemma 4.5, Prop. 4.6 | double-counting & bijective cuts | Labeled (); DP/MITM ; bulk |
| Example 4.7, Theorem 4.8 | Cayley–Hamilton on () | Exact Krylov annihilator () |
Table 4. Logical dependency and computational verification ledger.
Proof-Dependency Ledger, Archiving, and AI Provenance Statement
AI Provenance and Public Availability. In accordance with transparent disclosure standards for AI-generated mathematical research, we state explicitly that this work is a joint AI–human collaborative study orchestrated by Seon-Woo Hong using a confidential prompting architecture. Primary mathematical derivations, Dedekind domain extensions, transfer-operator constructions, verification code, and manuscript prose (Versions 1.0–2.6) were generated by Google Gemini (model: gemini-4-carbon); independent adversarial mathematical auditing, the explicit counterexample to -periodicity, Chu–Vandermonde period-bound critiques, and Stage 1 prefix-graph completeness reviews across Versions 2.0–2.6 were contributed by OpenAI ChatGPT. No claim of unaided human mathematical derivation is made. Self-contained mathematical proofs and prompt-independent computational verification are provided in Sections 2–4 and Appendix A, archived publicly on CERN Zenodo.
References
Appendix A. Standalone Exact-Arithmetic Verification Script
Tested under Python 3.12.5, NumPy 2.1.3, and SymPy 1.13.3 (and cross-tested under Python 3.13.5, NumPy 2.3.5, SymPy 1.14.0; save as verify.py and run python3 verify.py). The script executes finite-range sufficiency and full-period CRT necessity checks for Theorems 2.4–3.2, pure-integer Stage 1 contraction cross-checked against raw labeled backtracking (build_u0_labeled, where dg[x] \in \{0, 1, 2\} records consumed slot capacity , so 2 marks a closed vertex) for , direct path enumeration for () of OEIS A179967 (in mitm_odd_vec, each path on odd splits uniquely at midpoint into two -vertex half-paths with masks and , using graph reflection to halve the midpoint loop), subset-DP bulk checks (, ), and exact Krylov annihilator verification over .
import math
from collections import defaultdict
from fractions import Fraction
import numpy as np
import sympy as sp
def binom_theta(x, y, d, n):
c0, c1 = 1, 0
kc = (d - 1) // 4 if (d % 4 == 1) else None
for j in range(n):
u = x - j
if kc is None: c0, c1 = c0 * u + d * c1 * y, c0 * y + c1 * u
else: c0, c1 = c0 * u + kc * c1 * y, c0 * y + c1 * u + c1 * y
den = math.factorial(n)
return Fraction(c0, den), Fraction(c1, den)
def vp_fact(n, p):
s = 0
while n >= p: n //= p; s += n
return s
def is_y_feasible_crt(y, d, n):
kc = (d - 1) // 4 if (d % 4 == 1) else None
for p in sp.primerange(2, n + 1):
pe = p ** vp_fact(n, p); ok_p = False
for xp in range(pe):
c0, c1 = 1, 0
for j in range(n):
u = (xp - j) % pe
if kc is None: c0, c1 = (c0 * u + d * c1 * y) % pe, (c0 * y + c1 * u) % pe
else: c0, c1 = (c0 * u + kc * c1 * y) % pe, (c0 * y + c1 * u + c1 * y) % pe
if c0 == 0 and c1 == 0: ok_p = True; break
if not ok_p: return False
return True
def A387569_formula(n):
req2, t2 = 2 * vp_fact(n, 2), 0
while (2 * sum((n + (1 << s) - 1) >> s for s in range(1, t2 + 1))
+ ((n + (1 << (t2 + 1)) - 1) >> (t2 + 1)) < req2):
t2 += 1
res = 1 << t2
for p in sp.primerange(3, n + 1):
if p % 4 == 3:
reqp, acc, pk = vp_fact(n, p), 0, 1
while acc < reqp: pk *= p; acc += (n + pk - 1) // pk
res *= pk
return res
def A392059_def(n):
res = 1
for p in [2] + [q for q in sp.primerange(3, n + 1) if q % 4 == 3]:
pk = 1
while pk * p <= n: pk *= p
res *= pk
return res
def verify_number_theory():
oeis_23 = [1, 2, 3, 12, 6, 6, 42, 168, 252, 84, 924, 2772, 924, 924,
2772, 3696, 924, 5544, 52668, 105336, 52668, 105336, 1211364]
assert [A387569_formula(n) for n in range(1, 24)] == oeis_23
for n in range(1, 28):
y = A387569_formula(n); r0, r1 = binom_theta(y, y, -1, n)
assert r0.denominator == 1 and r1.denominator == 1
if n <= 16:
assert is_y_feasible_crt(y, -1, n)
for q in sp.factorint(y): assert not is_y_feasible_crt(y // q, -1, n)
if n <= 9: assert all(not is_y_feasible_crt(b, -1, n) for b in range(1, y))
yk_d5 = [next(y for y in range(1, 500) if is_y_feasible_crt(y, -5, n))
for n in range(1, 13)]
assert yk_d5 == [1, 2, 1, 4, 10, 2, 2, 8, 4, 20, 220, 220]
assert binom_theta(-10, 4, -3, 4) == (Fraction(931, 3), Fraction(-1463, 3))
assert binom_theta(-2, 4, -3, 4) == (Fraction(-5, 1), Fraction(11, 1))
for n in range(1, 16):
k, sh = A392059_def(n), 1 << (n.bit_length() - 1)
xs = n - sh; r0, r1 = binom_theta(xs, k, -1, n)
assert r0.denominator == 1 and r1.denominator == 1
assert (int(r0) - math.comb(xs, n) + int(r1)) % 2 == 1
for m in range(1, n + 1):
u0, u1 = binom_theta(0, 2 * k, -1, m)
assert u0.denominator == 1 and u1.denominator == 1
assert (int(u0) + int(u1)) % 2 == 0
if n <= 8:
for c in range(n + 1):
for x in range(-8, 10):
rc, ic = binom_theta(x, k, -1, c)
assert rc.denominator == 1 and ic.denominator == 1
assert ((int(rc) + int(ic)) % 2) == (int(sp.binomial(x + sh, c)) % 2)
print("[PASS] A387569 suff n<=27, prime-del n<=16, min-y n<=9; "
"Z[sqrt(-5)] n<=12; A392059 n<=15.")
def verify_combinatorics():
def held_karp(N, th):
M = 1 << N; dp = np.zeros((M, N), dtype=np.int64)
for u in range(N): dp[1 << u, u] = 1
adj = [[v for v in range(N) if abs(u - v) > th] for u in range(N)]
pop = np.array([bin(i).count("1") for i in range(M)], dtype=np.uint8)
for s in range(1, N):
masks = np.nonzero(pop == s)[0]
for u in range(N):
col = dp[masks, u]; nz = np.nonzero(col)[0]
if not len(nz): continue
ms, ws = masks[nz], col[nz]
for v in adj[u]:
b = 1 << v; ok = (ms & b) == 0
if np.any(ok): dp[ms[ok] | b, v] += ws[ok]
return int(dp[M - 1].sum())
def mitm_odd_vec(N, th):
# Split odd N = 2L-1 at midpoint u = p(L); reflection v <-> N-1-v halves midpoint loop
L = N // 2 + 1
adj = [[v for v in range(N) if abs(u - v) > th] for u in range(N)]
cur_m = [np.array([1 << u], dtype=np.uint32) for u in range(N)]
cur_w = [np.array([1], dtype=np.int64) for u in range(N)]
for _ in range(2, L + 1):
in_m, in_w = [[] for _ in range(N)], [[] for _ in range(N)]
for u in range(N):
ms = cur_m[u]
if not len(ms): continue
ws = cur_w[u]
for v in adj[u]:
bit = np.uint32(1 << v); ok = (ms & bit) == 0
if np.any(ok):
in_m[v].append(ms[ok] | bit); in_w[v].append(ws[ok])
for v in range(N):
if not in_m[v]:
cur_m[v] = np.empty(0, dtype=np.uint32)
cur_w[v] = np.empty(0, dtype=np.int64)
else:
am, aw = np.concatenate(in_m[v]), np.concatenate(in_w[v])
od = np.argsort(am, kind='mergesort'); am, aw = am[od], aw[od]
df = np.empty(len(am), dtype=bool); df[0] = True; df[1:] = am[1:] != am[:-1]
ix = np.nonzero(df)[0]; cur_m[v] = am[ix]; cur_w[v] = np.add.reduceat(aw, ix)
full = np.uint32((1 << N) - 1); tot = 0
for u in range((N + 1) // 2):
mult = 2 if u < N - 1 - u else 1; ms, ws = cur_m[u], cur_w[u]
if not len(ms): continue
cp = (full ^ ms) | np.uint32(1 << u)
ps = np.clip(np.searchsorted(ms, cp), 0, len(ms) - 1); ht = (ms[ps] == cp)
tot += mult * int(np.sum(ws[ht] * ws[ps[ht]]))
return tot
imap = {('U','U'):3, ('U','Va'):4, ('U','Vf'):5, ('E','U'):6,
('Va','Va'):7, ('Va','Vf'):8, ('E','Va'):9, ('Vf','Vf'):10, ('E','Vf'):11}
def add_c(a, t1, t2):
p = (t1, t2) if t1 <= t2 else (t2, t1)
if p == ('E', 'E'): return False
a[imap[p]] += 1; return True
def build_u0(k):
states = {(0, k - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0): 1}
for r in range(1, k + 1):
if r >= 2:
nu = defaultdict(int)
for st, w in states.items():
nu[(st[0]+1,) + st[1:]] += w
if st[12] < 2: a = list(st); a[6] += 1; a[12] += 1; nu[tuple(a)] += w
states = nu
nxt = defaultdict(int)
for st, ways in states.items():
qU, qVa, qVf, UU, UVa, UVf, UE, VaVa, VaVf, VaE, VfVf, VfE, et = st
if et < 2:
for mu, di, oe in [(qU,0,'U'),(qVa,1,'Va'),(2*UU,3,'U'),(UVa,4,'Va'),
(UVf,5,'Vf'),(UVa,4,'U'),(2*VaVa,7,'Va'),(VaVf,8,'Vf')]:
if mu: a = list(st); a[di] -= 1; a[12] += 1; add_c(a,'E',oe); nxt[tuple(a)] += ways*mu
cats = [(0,qU,0,'U'),(1,qVa,1,'Va'),(2,2*UU,3,'U'),(3,UVa,4,'Va'),(4,UVf,5,'Vf'),
(5,UE,6,'E'),(6,UVa,4,'U'),(7,2*VaVa,7,'Va'),(8,VaVf,8,'Vf'),(9,VaE,9,'E')]
for i in range(10):
c1, n1, i1, o1 = cats[i]
if not n1: continue
if n1 >= 2 and o1 != 'E':
w2 = 2*UU*(UU-1) if c1==2 else (2*VaVa*(VaVa-1) if c1==7 else n1*(n1-1)//2)
if w2:
a = list(st); a[i1] -= 2
if add_c(a, o1, o1): nxt[tuple(a)] += ways * w2
for j in range(i + 1, 10):
c2, n2, i2, o2 = cats[j]
if not n2 or (o1 == 'E' and o2 == 'E'): continue
w12 = UVa*(UVa-1) if (c1==3 and c2==6) else n1*n2
if w12:
a = list(st); a[i1] -= 1; a[i2] -= 1
if add_c(a, o1, o2): nxt[tuple(a)] += ways * w12
states = nxt
NVa = k - r
if NVa >= 1:
ne = defaultdict(int)
for st, ways in states.items():
qU, qVa, qVf, UU, UVa, UVf, UE, VaVa, VaVf, VaE, VfVf, VfE, _ = st
sVa = NVa - qVa - (UVa + 2*VaVa + VaVf + VaE)
if sVa > 0:
assert (ways * sVa) % NVa == 0
ne[st] += (ways * sVa) // NVa
for cnt, d1, d2 in [(qVa,1,2),(UVa,4,5),(2*VaVa,7,8),(VaVf,8,10),(VaE,9,11)]:
if cnt > 0:
assert (ways * cnt) % NVa == 0
a = list(st); a[d1] -= 1; a[d2] += 1
ne[tuple(a)] += (ways * cnt) // NVa
states = ne
out = defaultdict(int)
for st, ways in states.items():
qU, qVa, qVf, UU, UVa, UVf, UE, VaVa, VaVf, VaE, VfVf, VfE, et = st
assert qVa == 0 and UVa == 0 and VaVa == 0 and VaVf == 0 and VaE == 0
cu = qU + UU; hd = (2*cu+UVf+UE) - (2*qVf+2*VfVf+UVf+VfE); re = 2 - et
if abs(hd) <= re and (hd - re) % 2 == 0:
out[(cu, UVf, UE, qVf, VfVf, VfE, et)] += ways * (1 << UU)
return dict(out)
def build_u0_labeled(k):
# dg[x] in {0,1,2}: consumed slot capacity deg_C(x) + is_endpoint(x); 2 = closed
nb = 2 * k - 2
st = {(tuple([0]*nb), tuple(range(nb)), 0): 1}
for r in range(1, k + 1):
nb_r = list(range(r - 1)) + list(range(k - 2 + r, nb))
nx = defaultdict(int)
for (dg, mt, ec), w in st.items():
if ec < 2:
for x in nb_r:
if dg[x] == 0:
d2, m2 = list(dg), list(mt); d2[x] = 1; m2[x] = -1
nx[(tuple(d2), tuple(m2), ec + 1)] += w
elif dg[x] == 1 and mt[x] != -1:
ox = mt[x]; d2, m2 = list(dg), list(mt)
d2[x] = 2; m2[x] = -2; m2[ox] = -1
nx[(tuple(d2), tuple(m2), ec + 1)] += w
for i, x in enumerate(nb_r):
if dg[x] == 2: continue
for y in nb_r[i+1:]:
if dg[y] == 2 or (dg[x] == 1 and mt[x] == y): continue
ex = x if dg[x] == 0 else mt[x]
ey = y if dg[y] == 0 else mt[y]
if ex == -1 and ey == -1: continue
d2, m2 = list(dg), list(mt); d2[x] += 1; d2[y] += 1
if dg[x] == 1: m2[x] = -2
if dg[y] == 1: m2[y] = -2
if ex >= 0: m2[ex] = ey
if ey >= 0: m2[ey] = ex
nx[(tuple(d2), tuple(m2), ec)] += w
st = nx
out = defaultdict(int)
for (dg, mt, ec), w in st.items():
cs = [i for i in range(k - 1) if dg[i] < 2]
eps = [()] + ([(x,) for x in cs] if ec <= 1 else [])
if ec == 0:
eps += [(cs[a], cs[b]) for a in range(len(cs)) for b in range(a+1, len(cs))]
for ep in eps:
d2, m2, e2, ok = list(dg), list(mt), ec, True
for x in ep:
if d2[x] == 0: d2[x] = 1; m2[x] = -1; e2 += 1
elif m2[x] == -1: ok = False; break
else: ox = m2[x]; d2[x] = 2; m2[x] = -2; m2[ox] = -1; e2 += 1
if not ok: continue
qU = sum(1 for i in range(k - 1) if d2[i] == 0)
qV = sum(1 for j in range(k - 1, nb) if d2[j] == 0)
uu = sum(1 for i in range(k - 1) if d2[i] == 1 and 0 <= m2[i] < k - 1) // 2
vv = sum(1 for j in range(k - 1, nb) if d2[j] == 1 and m2[j] >= k - 1) // 2
uv = sum(1 for i in range(k - 1) if d2[i] == 1 and m2[i] >= k - 1)
eu = sum(1 for i in range(k - 1) if d2[i] == 1 and m2[i] == -1)
ev = sum(1 for j in range(k - 1, nb) if d2[j] == 1 and m2[j] == -1)
cu = qU + uu; hd = (2*cu + uv + eu) - (2*qV + 2*vv + uv + ev); re = 2 - e2
if abs(hd) <= re and (hd - re) % 2 == 0:
out[(cu, uv, eu, qV, vv, ev, e2)] += w * (1 << uu)
return dict(out)
def v_sat(cu, uvf, ue, qvf, vfvf, vfe, et, w, nxt, dec_q, can_cl):
cl = 0; qn = qvf - (1 if dec_q else 0)
if et < 2:
if cu > 0: nxt[(cu-1, uvf, ue+1, qn, vfvf, vfe, et+1)] += w * cu
if uvf > 0: nxt[(cu, uvf-1, ue, qn, vfvf, vfe+1, et+1)] += w * uvf
if can_cl and ue == 1 and cu == 0 and uvf == 0 and et == 1: cl += w
if cu >= 2: nxt[(cu-1, uvf, ue, qn, vfvf, vfe, et)] += w * cu * (cu - 1)
if uvf >= 2: nxt[(cu, uvf-2, ue, qn, vfvf+1, vfe, et)] += w * (uvf*(uvf-1)//2)
if cu >= 1 and uvf >= 1: nxt[(cu-1, uvf, ue, qn, vfvf, vfe, et)] += w * cu * uvf
if cu >= 1 and ue >= 1: nxt[(cu-1, uvf, ue, qn, vfvf, vfe, et)] += w * cu * ue
if uvf >= 1 and ue >= 1: nxt[(cu, uvf-1, ue-1, qn, vfvf, vfe+1, et)] += w * uvf * ue
if can_cl and ue == 2 and cu == 0 and uvf == 0 and et == 2: cl += w
return cl
def close_vr(work):
tot = 0
while work:
nxt = defaultdict(int)
for (cu, uvf, ue, qvf, vfvf, vfe, et), w in work.items():
rem = qvf + 2*vfvf + uvf + vfe
if not rem: continue
last = (rem == 1)
if qvf > 0: tot += v_sat(cu, uvf, ue, qvf, vfvf, vfe, et, w, nxt, True, last)
elif vfe > 0:
if last and et == 1 and cu == 0 and uvf == 0 and ue == 0: tot += w
if cu > 0: nxt[(cu-1, uvf, ue+1, 0, vfvf, vfe-1, et)] += w * cu
if uvf > 0: nxt[(cu, uvf-1, ue, 0, vfvf, vfe, et)] += w * uvf
if last and ue == 1 and cu == 0 and uvf == 0 and et == 2: tot += w
elif vfvf > 0:
if et < 2: nxt[(cu, uvf, ue, 0, vfvf-1, vfe+1, et+1)] += w
if cu > 0: nxt[(cu, uvf+1, ue, 0, vfvf-1, vfe, et)] += w * cu
if uvf > 0: nxt[(cu, uvf-1, ue, 0, vfvf, vfe, et)] += w * uvf
if ue > 0: nxt[(cu, uvf, ue-1, 0, vfvf-1, vfe+1, et)] += w * ue
else:
if et < 2: nxt[(cu, uvf-1, ue+1, 0, 0, 0, et+1)] += w
if cu > 0: nxt[(cu-1, uvf, ue, 0, 0, 0, et)] += w * cu * 2
if uvf >= 2: nxt[(cu, uvf-1, ue, 0, 0, 0, et)] += w * (uvf - 1)
if ue > 0: nxt[(cu, uvf-1, ue, 0, 0, 0, et)] += w * ue
work = nxt
return 2 * tot
def trans(st):
if st == ('CLOSED',): return {}
cu0, uvf0, ue0, qvf0, vfvf0, vfe0, et0 = st
au = [(cu0+1, uvf0, ue0, qvf0, vfvf0, vfe0, et0, 1)]
if et0 < 2: au.append((cu0, uvf0, ue0+1, qvf0, vfvf0, vfe0, et0+1, 1))
out = defaultdict(int)
for cu, uvf, ue, qvf, vfvf, vfe, et, wu in au:
vr = qvf + 2*vfvf + uvf + vfe
cl = v_sat(cu, uvf, ue, qvf, vfvf, vfe, et, wu, out, False, vr == 0)
if cl: out[('CLOSED',)] += cl
return {ns: w for ns, w in out.items() if w and (ns == ('CLOSED',) or
(abs((2*ns[0]+ns[1]+ns[2]) - (2*ns[3]+2*ns[4]+ns[1]+ns[5])) <= 2-ns[6]
and ((2*ns[0]+ns[1]+ns[2]) - (2*ns[3]+2*ns[4]+ns[1]+ns[5]) - (2-ns[6])) % 2 == 0))}
dims_exp = {2:1, 3:12, 4:31, 5:55, 6:79, 7:114, 8:147, 9:193}
for k in range(2, 10):
u0 = build_u0(k)
if k <= 5: assert u0 == build_u0_labeled(k)
vis, q, adj = set(u0.keys()), list(u0.keys()), {}
while q:
s = q.pop(); tr = trans(s); adj[s] = tr
for ns in tr:
if ns not in vis: vis.add(ns); q.append(ns)
sl = sorted(vis, key=str); idx = {s: i for i, s in enumerate(sl)}; D = len(sl)
assert D == dims_exp[k]
wv = [2 if s == ('CLOSED',) else close_vr({s: 1}) for s in sl]
uv = [u0.get(s, 0) for s in sl]
spT = [[(idx[ns], wt) for ns, wt in adj[s].items()] for s in sl]
roots = [(C + 1) * (k - 1 - C) for C in range((k - 1) // 2 + 1)]
z = list(wv)
for lam in roots:
Tz = [sum(wt * z[j] for j, wt in spT[i]) for i in range(D)]
z = [Tz[i] - lam * z[i] for i in range(D)]
cu_v = list(uv); seq_k = []
for m_s in range(max(D + 2, 13)):
assert sum(z[i] * cu_v[i] for i in range(D)) == 0
if m_s <= 12: seq_k.append(sum(wv[i] * cu_v[i] for i in range(D)))
nx = [0] * D
for i, val in enumerate(cu_v):
if val:
for j, wt in spT[i]: nx[j] += wt * val
cu_v = nx
if k <= 6:
for m_s in range(len(seq_k)):
nv = k - 1 + m_s
if 2 * nv + k <= 16:
assert seq_k[m_s] == held_karp(2 * nv + k, nv)
for di in range(len(roots)):
zs = list(wv)
for lam in (roots[:di] + roots[di+1:]):
Tz = [sum(wt * zs[j] for j, wt in spT[i]) for i in range(D)]
zs = [Tz[i] - lam * zs[i] for i in range(D)]
ct = list(uv); van = True
for _ in range(10):
if sum(zs[i] * ct[i] for i in range(D)) != 0: van = False; break
nx = [0] * D
for i, val in enumerate(ct):
if val:
for j, wt in spT[i]: nx[j] += wt * val
ct = nx
assert not van
if k == 9:
a_seq = ([held_karp(2*n+9, n) for n in range(5)]
+ [mitm_odd_vec(2*n+9, n) for n in (5, 6, 7)])
a_seq.extend(seq_k)
den = [1, -80, 2508, -38336, 283840, -806400]
num_exp = [362880, -23733610, 574782136, -6066574082, 23063767496, 1306804904,
19195078240, 99691196928, 5798373293056, 140546260769280,
-1838864889858048, 0, 0]
assert [sum(a_seq[n-j]*den[j] for j in range(min(n+1, 6))) for n in range(13)] == num_exp
print("[PASS] Stage-1 labeled check k<=5, DP/MITM n<=7, bulk DP 2n+k<=16, & Krylov D_k<=193.")
if __name__ == "__main__":
verify_number_theory()
verify_combinatorics()References
- [1]M. Bhargava, The factorial function and generalizations, Amer. Math. Monthly 107 (2000), no. 9, 783–799.
- [2]P.-J. Cahen and J.-L. Chabert, Inter-Valued Polynomials, Math. Surveys Monogr., vol. 48, Amer. Math. Soc., Providence, RI, 1997.
- [3]A. Chand, Universal matrices for counting Fibonacci and C-nomial coefficients by their p-adic valuations, preprint (2025), arXiv:2508.18461.arxiv.org/abs/2508.18461
- [4]W. K. Hale, Frequency assignment: theory and applications, Proc. IEEE 68 (1980), no. 12, 1497–1514.DOI
- [5]J. Y.-T. Leung, O. Vornberger, and J. D. Witthoff, On some variants of the bandwidth minimization problem, SIAM J. Comput. 13 (1984), no. 3, 650–667.DOI
- [6]K. Mahler, An interpolation series for continuous functions of a p-adic variable, J. Reine Angew. Math. 199 (1958), 23–34.DOI
- [7]Z. Miller and D. Pritikin, On the separation number of a graph, Networks 19 (1989), no. 6, 651–666.DOI
- [8]OEIS Foundation Inc., Entry A179967 (conjectures and table for 0 ≤ n ≤ 763 by S. Manyama, August 2026), https://oeis.org/A179967.
- [9]OEIS Foundation Inc., Entry A322255 (and diagonals A129534, A179962–A179967), https://oeis.org/A322255.
- [10]OEIS Foundation Inc., Entry A387569 (R. Zhou and M. Marcus, 2025–2026), https://oeis.org/A387569.
- [11]OEIS Foundation Inc., Entry A392059 (R. Zhou, 2025–2026), https://oeis.org/A392059.
- [12]E. Rowland, A matrix generalization of a theorem of Fine, Integers 18A (2018), Article A18, arXiv:1704.05872.arxiv.org/abs/1704.05872