Can two consecutive cycles divide a permutation?
Write C t C_t C t for a directed cycle of length t t t . We add permutations by taking their disjoint union and multiply them by advancing both coordinates one step at a time. We identify isomorphic permutations. In the product C a C t C_aC_t C a C t , each pair returns to its starting point after lcm ( a , t ) \operatorname{lcm}(a,t) lcm ( a , t ) steps. Dividing the a t at a t states by this orbit length gives the product rule
C a C t = gcd ( a , t ) C lcm ( a , t ) . C_aC_t = \gcd(a,t)\,C_{\operatorname{lcm}(a,t)}. C a C t = g cd( a , t ) C lcm ( a , t ) .
The smallest consecutive lengths greater than one are two and three. Consider the division problem
( C 2 + C 3 ) X = C 3 + 2 C 6 . (C_2 + C_3)X = C_3 + 2C_6. ( C 2 + C 3 ) X = C 3 + 2 C 6 .
The right side has fifteen states, so X X X must have three. Its product with C 2 C_2 C 2 uses six states and has only even cycle lengths. It must therefore account for one C 6 C_6 C 6 . On three states only X = C 3 X = C_3 X = C 3 can produce that length. Now look at what remains for C 3 X C_3X C 3 X . The required C 3 + C 6 C_3 + C_6 C 3 + C 6 can be obtained from X = C 1 + C 2 X = C_1 + C_2 X = C 1 + C 2 , whereas the choice already forced gives C 3 X = 3 C 3 C_3X = 3C_3 C 3 X = 3 C 3 . The two parts of the product, which we call the projections , are individually possible. No single quotient realises both. The input gives only their union B B B . If both projections contain cycles of the same length, their multiplicities add in B B B .
Doré et al. give a polynomial-time division algorithm for connected quotients [11 ] , Theorem 3.13. Their unroll starts at each periodic state and follows its predecessors to form a rooted tree. For a disconnected quotient they ask which periods to choose when rolling these trees back into cycles. They can also construct the two extreme rolls, which group the copies of each recurring tree pattern into as few or as many components as possible [11 Algorithm 5.10 and Section 6, p. 14] . For permutations this question takes a simple form. Each state has exactly one predecessor, so every permutation on n n n states unrolls to n n n identical one-way infinite paths [11 Remark 2.3] . Grouping those paths into cycles amounts to choosing a partition of n n n . In the example above, 3 3 3 , 2 + 1 2+1 2 + 1 and 1 + 1 + 1 1+1+1 1 + 1 + 1 all give the required unroll. The prescribed product rules out all three. Changing the target to 3 C 2 + C 3 + C 6 3C_2+C_3+C_6 3 C 2 + C 3 + C 6 gives a useful comparison. Of the same three partitions, only 2 + 1 2+1 2 + 1 works, so the quotient is C 1 + C 2 C_1+C_2 C 1 + C 2 [22 Section 2] .
How much does it help to know that the two lengths are consecutive? For coprime lengths, every instance can be put in this form. The same holds for the reduced lengths of any pair. The new divisor retains the original greatest common divisor.
In the binary model we give each distinct cycle length together with its positive multiplicity , using self-delimiting binary fields of size linear in their bit lengths. In the explicit model we give the successor of every state. A single cycle of length 2 k 2^k 2 k takes O ( k ) O(k) O ( k ) bits in a binary list and 2 k 2^k 2 k entries in a successor table. The total number of states in the divisor and target is N = ∣ A ∣ + ∣ B ∣ N=|A|+|B| N = ∣ A ∣ + ∣ B ∣ , so the tables take O ( N log ( 2 N ) ) O(N\log(2N)) O ( N log ( 2 N )) bits. Until Corollary 8.2, A A A , B B B are nonempty permutations, and we ask whether A X = B AX=B A X = B for some X X X with any number of cycles. Allowing arbitrary finite self-maps X X X gives the same question. A transient state of X X X would give a transient state in the product, and every state of B B B is periodic. Corollary 8.2 returns to the case where the target itself has transient states.
Theorem A (Consecutive lengths after removing the gcd). Let A = C a + C b A=C_a+C_b A = C a + C b and g = gcd ( a , b ) g=\gcd(a,b) g = g cd( a , b ) . In either input representation one can construct, in deterministic polynomial time, a divisor A ′ = C g d + C g ( d + 1 ) A'=C_{gd}+C_{g(d+1)} A ′ = C g d + C g ( d + 1 ) with d ≥ 2 d\geq2 d ≥ 2 and a target B ′ B' B ′ . The quotient classes of A X = B AX=B A X = B and A ′ Y = B ′ A'Y=B' A ′ Y = B ′ are in bijection. Both directions of the bijection are computable in time polynomial in the input and the supplied quotient. The integer g g g may vary with the input. In the explicit model the two output tables have O ( N 4 ) O(N^4) O ( N 4 ) states in total.
The first step in the proof recovers a piece of information hidden by the product. Whenever both projections can contribute at the same length, their individual contributions there are forced by their numbers of states. We recover this split both before and after changing the divisor lengths. It determines which part of the target to use in each direction. § 3.1 gives the map.
Write D 2 \mathcal{D}_2 D 2 for the explicit decision problem with A = C a + C b A=C_a+C_b A = C a + C b , a , b > 1 a,b>1 a , b > 1 , gcd ( a , b ) = 1 \gcd(a,b)=1 g cd( a , b ) = 1 . The lengths are part of the input. Write SAT for Boolean satisfiability and QP for deterministic quasipolynomial time, meaning time exp ( O ( ( log ( m + 2 ) ) c ) ) \exp(O((\log(m+2))^c)) exp ( O (( log ( m + 2 ) ) c )) for some constant c ≥ 1 c\geq1 c ≥ 1 on m m m -bit inputs.
Theorem 1.1 (Two representations). For divisors C 2 + C b C_2+C_b C 2 + C b with b > 1 b>1 b > 1 odd and part of the input, binary division is N P NP N P -complete, and counting quotient isomorphism classes is # P \#P # P -complete under parsimonious polynomial-time reductions. On the same family, explicit division admits a deterministic polynomial-time algorithm that gives the exact count and constructs one quotient whenever one exists.
For the full explicit problem D 2 \mathcal{D}_2 D 2 , the following statements hold.
If SAT has a deterministic polynomial-time Turing reduction to D 2 \mathcal{D}_2 D 2 , then P = N P P=NP P = N P .
D 2 ∈ Q P \mathcal{D}_2\in QP D 2 ∈ QP if and only if N P ⊆ Q P NP\subseteq QP N P ⊆ QP .
D 2 ∈ P \mathcal{D}_2\in P D 2 ∈ P if and only if SAT on m m m -bit formulas is decidable in deterministic time m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) . A polynomial-time decision algorithm for D 2 \mathcal{D}_2 D 2 also suffices to construct one quotient as a successor table whenever one exists.
Consequently, D 2 \mathcal{D}_2 D 2 is NP-intermediate under polynomial-time many-one reductions exactly when SAT has no deterministic m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) -time algorithm. If N P ⊈ Q P NP\not\subseteq QP N P ⊆ QP , then D 2 \mathcal{D}_2 D 2 also lies outside Q P QP QP .
For C 2 + C b C_2 + C_b C 2 + C b , group quotient lengths t t t by R = lcm ( 2 , b , t ) R = \operatorname{lcm}(2,b,t) R = lcm ( 2 , b , t ) . The C b C_b C b projection gives length v = lcm ( b , t ) v = \operatorname{lcm}(b,t) v = lcm ( b , t ) . Since R = lcm ( 2 , v ) R = \operatorname{lcm}(2,v) R = lcm ( 2 , v ) , only R R R and R / 2 R/2 R /2 are possible. A dynamic program tracks their totals. The 2 : b 2:b 2 : b ratio of projection sizes gives the other totals it needs (§ 2 ). The running time is polynomial in the number N = ∣ A ∣ + ∣ B ∣ N = |A| + |B| N = ∣ A ∣ + ∣ B ∣ of states. A short binary list can describe exponentially many states. § 7 encodes each triple in the digits of a cycle length and gives a bijection between exact covers and quotient classes. Such a reduction is called parsimonious .
To understand the threshold in part (iii), start with a division input on N N N states. Each block becomes a SAT question of bit length ℓ \ell ℓ with ( log ℓ ) ( log log ℓ ) = O ( log N ) (\log\ell)(\log\log\ell) = O(\log N) ( log ℓ ) ( log log ℓ ) = O ( log N ) . The proposed SAT running time is therefore polynomial in N N N . For the reverse implication we turn a formula into a cubic graph, encode a proper edge-colouring by a weighted table and realise its cells as quotient cycles. The costliest step is writing the two successor tables. Appendix § 12 bounds this cost by m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) on every formula.
Part (i) concerns reductions that themselves run in polynomial time. A many-one reduction produces one instance. A Turing reduction can adapt its next query to the answers already received. Even in this latter model a reduction from SAT would allow us to decide SAT recursively on shorter formulas. The short-query principle of Allender and Koucký then gives polynomial time [1 Theorem 5.1(3)] . Thus if SAT misses the threshold in (iii), explicit division is NP-intermediate: it belongs to NP, lies outside P and is not NP-complete.
For the representation contrast alone, § 2 and § 7 give the algorithm and the reduction. For binary lists in the normal form, varying d d d already gives NP-completeness at g = 1 g = 1 g = 1 . Holding d = 2 d = 2 d = 2 fixed and varying g g g makes one quotient easy to construct. Proposition C.3 explains why finding out whether there is a second is equivalent to factoring integers. For successor tables, Corollary 8.1 gives the SAT and counting thresholds for arbitrary pairs of lengths. The earlier NP-completeness proof allows the number of divisor cycles to grow [20 p. 14] .
Readers interested in the period-selection question can follow the proof of the normal form in § 3.1 directly to the extension to rooted trees in Corollary 8.2.
Relation to known algorithms
For permutations given by cycle lists, Porreca and Rolland’s binary algorithm applies when the shortest divisor length divides every other one. They ask about extending this condition to several seeds [26 Theorem 42 and Section 7] . Theorem 1.1 gives the complexity of the binary problem when two incomparable lengths are allowed. Crespelle, Phan and Richard describe quotients recursively and work out a division with divisor C 2 + C 3 C_2 + C_3 C 2 + C 3 [8 Theorem 3.8 and Example 3.14] . Here the two lengths vary with the input and we track the time needed to write their successor tables. In the explicit model, Bridoux et al. split an instance into independent smaller ones and rescale their quotient lengths. Their decomposition generally gives a list of instances [5 Lemmas 2 and 8] . Theorem A gives a single instance with consecutive reduced lengths and the original divisor gcd. Their counting theorem gives polynomial time whenever the number of divisors of lcm ( a , b ) \operatorname{lcm}(a,b) lcm ( a , b ) stays bounded [5 Theorem 1] . Two distinct primes, or the squares of two distinct primes, satisfy that condition. To see the difference when the bound grows, take a = 2 a = 2 a = 2 and let b b b be the product of k ≥ 2 k \ge2 k ≥ 2 distinct odd primes. Then 2 b 2b 2 b has 2 k + 1 2^{k+1} 2 k + 1 divisors, so the exponent in their bound grows with k k k . The dynamic program below keeps just two running totals for every such b b b . For two cycles of lengths a , b a,b a , b , divide both lengths by g = gcd ( a , b ) g = \gcd(a,b) g = g cd( a , b ) . Theorem 2.2 gives polynomial-time explicit counting when one of these two reduced lengths has a bounded number of divisors. If both divisor counts are bounded, Proposition B.2 constructs one binary quotient in polynomial time. Thus for every divisor C 2 g + C 3 g C_{2g} + C_{3g} C 2 g + C 3 g we can find a quotient efficiently from binary lists, although the exact count can itself take superpolynomially many bits (Proposition C.2 ).
Gadoulea u and Johnson solve the cycle division equation with multiplicities taken modulo two [15 Theorem 3.9] . Our binary lists retain every digit of each multiplicity. For example, C 2 + C 3 C_2 + C_3 C 2 + C 3 divides itself. Adding two fixed points to the target preserves its parity data but makes division impossible, since every cycle of the product has length divisible by two or three.
Ascone, Porreca and Rolland prove hardness for a linear equation in three unknowns and a constant right-hand side [2 p. 2] . Here only X X X is unknown. Given B B B alone, one may instead seek two connected factors [21 ] . A unique quotient can itself use many different cycle lengths when the number of divisor lengths grows [22 ] . With two coprime divisor cycles we can list all candidate lengths in polynomial time. It is the choice of multiplicities that encodes a colouring.
Solving the blocks of an explicit input
Read the cycle lengths of B B B from its successor table. Write β ℓ \beta_\ell β ℓ for the number of cycles of length ℓ \ell ℓ , taking zero for an absent length. A quotient must have n = ∣ B ∣ / ( a + b ) n = |B|/(a+b) n = ∣ B ∣/ ( a + b ) states, so a nonintegral n n n gives a negative answer. Its unknowns are the integers x t x_t x t counting cycles of length t t t , with 1 ≤ t ≤ n 1 \le t \le n 1 ≤ t ≤ n and 0 ≤ x t ≤ n 0 \le x_t \le n 0 ≤ x t ≤ n . To account for every copy of C ℓ C_\ell C ℓ , the product rule requires
∑ lcm ( a , t ) = ℓ gcd ( a , t ) x t + ∑ lcm ( b , t ) = ℓ gcd ( b , t ) x t = β ℓ . (1) \sum_{\operatorname{lcm}(a,t)=\ell} \gcd(a,t)x_t+\sum_{\operatorname{lcm}(b,t)=\ell} \gcd(b,t)x_t=\beta_\ell. \tag*{(1)} lcm ( a , t ) = ℓ ∑ g cd( a , t ) x t + lcm ( b , t ) = ℓ ∑ g cd( b , t ) x t = β ℓ . (1)
Write this equation for every length that can occur in either sum, including a zero right side wherever B B B forbids that length. Reject if some prescribed length has no possible contribution. When the two projections produce the same length, their coefficients add and the sum is at most a + b a+b a + b . These equations also account for the size of X X X . Multiplying the equation at ℓ \ell ℓ by ℓ \ell ℓ and summing gives ( a + b ) ∑ t t x t = ∣ B ∣ (a+b)\sum_t tx_t=|B| ( a + b ) ∑ t t x t = ∣ B ∣ . Rolland describes the admissible component types and their multiplicity equations for general finite systems [27 Propositions 4.40–4.41] . His witness algorithm is fixed-parameter tractable in the number of distinct target component types and the shortest divisor period [27 Theorem 4.43] . For C 2 + C b C_2+C_b C 2 + C b , the count below allows arbitrarily many distinct target lengths and any odd b > 1 b>1 b > 1 . The cycle product rule supplies the two contributions of each unknown.
Which equations can influence one another? Take a = 2 a=2 a = 2 , b = 3 b=3 b = 3 again and now allow n ≥ 5 n\ge5 n ≥ 5 . A C 3 C_3 C 3 contributes to lengths 6 and 3. A C 5 C_5 C 5 contributes to lengths 10 and 15. Taking the lcm with 6 gives the common value 6 for the first pair and 30 for the second. This value stays fixed along every chain of variables and the equations in which they occur. In particular, no such chain can connect the two pairs.
Lemma 2.1 (Short queries). For any two divisor cycles, explicit division reduces in polynomial time to the conjunction of at most N N N SAT queries. For sufficiently large N N N , each query has bit length exp ( O ( log N / log log N ) ) \exp(O(\log N/\log\log N)) exp ( O ( log N / log log N )) .
Proof. Let D = lcm ( a , b ) D=\operatorname{lcm}(a,b) D = lcm ( a , b ) . Give variable x t x_t x t the label R = lcm ( D , t ) R=\operatorname{lcm}(D,t) R = lcm ( D , t ) . Whenever it occurs in the equation at length ℓ \ell ℓ , that equation satisfies lcm ( D , ℓ ) = R \operatorname{lcm}(D,\ell)=R lcm ( D , ℓ ) = R . Taking the lcm of t t t first with a a a or b b b and then with D D D is the same as taking it directly with D D D . Thus equations with different labels use disjoint sets of variables. There are at most n n n nonempty blocks. We build them in polynomial time by running through t = 1 , … , n t=1,\ldots,n t = 1 , … , n and recording its two contributions.
To bound a single block, notice that every length t t t or ℓ \ell ℓ in it divides its label R R R , and R ≤ a b n ≤ N 3 R\le abn\le N^3 R ≤ abn ≤ N 3 . Write τ ( R ) \tau(R) τ ( R ) for the number of positive divisors of R R R . The block has at most τ ( R ) \tau(R) τ ( R ) variables and at most τ ( R ) \tau(R) τ ( R ) equations. Its coefficients, right sides and bounds take O ( log ( 2 N ) ) O(\log(2N)) O ( log ( 2 N )) bits apiece. Even a dense matrix, with rows and columns numbered locally, needs only O ( ( 1 + τ ( R ) ) 2 log ( 2 N ) ) O((1+\tau(R))^2\log(2N)) O (( 1 + τ ( R ) ) 2 log ( 2 N )) bits.
The elementary divisor estimate needed here is log τ ( R ) = O ( log N / log log N ) \log\tau(R)=O(\log N/\log\log N) log τ ( R ) = O ( log N / log log N ) . Set z = log ( N 3 ) z=\log(N^3) z = log ( N 3 ) . In the factorisation R = ∏ p e p R=\prod p^{e_p} R = ∏ p e p , each exponent is at most z / log 2 z/\log2 z / log 2 . Primes up to z \sqrt z z therefore contribute at most z log ( 1 + z / log 2 ) \sqrt z\log(1+z/\log2) z log ( 1 + z / log 2 ) to log τ ( R ) \log\tau(R) log τ ( R ) . The other primes have exponent sum at most 2 z / log z 2z/\log z 2 z / log z , and e + 1 ≤ 2 e e+1\le2^e e + 1 ≤ 2 e . The two estimates give the stated bound.
Feasibility of the resulting bounded integer system belongs to NP, since one can guess its multiplicities and check the equations. A fixed polynomial reduction to SAT raises the bit length of a block to at most a constant power, which preserves the claimed bound. Every block must be feasible, and solutions to separate blocks can be joined by taking all their multiplicities.
Proof of Theorem 1.1(i). Let an oracle algorithm decide SAT using D 2 D_2 D 2 in polynomial time. On an m m m -bit formula it asks at most m O ( 1 ) m^{O(1)} m O ( 1 ) questions, each of polynomial length. Simulate it in order. Answer a malformed table or a divisor outside the specified class negatively. For each valid question we have N ≤ m O ( 1 ) N \le m^{O(1)} N ≤ m O ( 1 ) . Lemma 2.1 gives a conjunction of at most N N N SAT queries, each of length at most ⌊ m ⌋ \lfloor\sqrt{m}\rfloor ⌊ m ⌋ for sufficiently large m m m . Evaluate the conjunction recursively and return its truth value before the simulation continues.
Below a fixed input size solve SAT by exhaustive search. Both the number of recursive calls along the simulated computation and the work to produce them are polynomial in m m m . If T ( m ) T(m) T ( m ) is the worst running time on inputs of at most m m m bits, some constant c c c gives T ( m ) ≤ m c ( 1 + T ( ⌊ m ⌋ ) ) T(m) \le m^c(1+T(\lfloor\sqrt{m}\rfloor)) T ( m ) ≤ m c ( 1 + T (⌊ m ⌋)) for large m m m . For any K > 2 c K > 2c K > 2 c , substituting the inductive bound T ( k ) = O ( k K ) T(k) = O(k^K) T ( k ) = O ( k K ) on shorter inputs gives O ( m c + K / 2 ) = O ( m K ) O(m^{c+K/2}) = O(m^K) O ( m c + K /2 ) = O ( m K ) . Thus SAT would belong to P. This includes a many-one reduction as the one-query case.
When the divisor has more cycles. The short-query argument uses only a bound on D = lcm { a i } D = \operatorname{lcm}\{a_i\} D = lcm { a i } . For a divisor ∑ i α i C a i \sum_i \alpha_i C_{a_i} ∑ i α i C a i , give x t x_t x t the same label R = lcm ( D , t ) R = \operatorname{lcm}(D,t) R = lcm ( D , t ) . Each possible output lcm ( a i , t ) \operatorname{lcm}(a_i,t) lcm ( a i , t ) has that label, and each matrix coefficient is at most ∑ i α i a i = ∣ A ∣ \sum_i \alpha_i a_i = |A| ∑ i α i a i = ∣ A ∣ . If D ≤ N c D \le N^c D ≤ N c for a fixed c c c , then R ≤ N c + 1 R \le N^{c+1} R ≤ N c + 1 , so the same divisor estimate gives the same short-query bound, with constants depending on c c c . This includes any fixed bound on the number of distinct divisor lengths, with arbitrary multiplicities. The block split is also implicit in the general decomposition of Bridoux et al. [5 Lemma 2] .
Counting a block from the reduced ratio of the two lengths
Consider A = C 2 + C b A = C_2 + C_b A = C 2 + C b . In a block labelled R R R , a length r r r coming from the C b C_b C b projection satisfies lcm ( r , 2 ) = R \operatorname{lcm}(r,2) = R lcm ( r , 2 ) = R . Thus r = R r = R r = R or r = R / 2 r = R/2 r = R /2 . We can remember the totals for these lengths even if the other projection produces many different lengths. For general a , b a,b a , b , a common factor actually reduces the number of possible row lengths. This is why the reduced ratio a : b a:b a : b enters the running time.
Write a row for the output of C a C_a C a and a column for the output of C b C_b C b . We can determine how many target cycles each must supply before choosing any quotient cycles. Write D = lcm ( a , b ) D = \operatorname{lcm}(a,b) D = lcm ( a , b ) , and group the target cycles of length ℓ \ell ℓ by R = lcm ( D , ℓ ) R = \operatorname{lcm}(D,\ell) R = lcm ( D , ℓ ) . Both projections of a quotient cycle of length t t t belong to the group with R = lcm ( D , t ) R = \operatorname{lcm}(D,t) R = lcm ( D , t ) . Reject a target length divisible by neither a a a nor b b b . In the group B R B_R B R , only the length R R R can occur in both projections: any such length is divisible by D D D and hence equals its label. The support of a block is the set of lengths occurring in it. Let β ℓ \beta_\ell β ℓ denote the target multiplicity, taking β R = 0 \beta_R = 0 β R = 0 if R R R is absent. The number of quotient states in the group must be n R = ∣ B R ∣ / ( a + b ) n_R = |B_R|/(a+b) n R = ∣ B R ∣/ ( a + b ) . Reject if it is nonintegral. The projection from C a C_a C a has a n R an_R a n R states, so its contribution at the only shared length is forced to be
m R = a n R − ∑ ℓ ∈ supp B R , ℓ ≠ R , a ∣ ℓ ℓ β ℓ R . (2) m_R = \frac{an_R-\sum_{\ell\in\operatorname{supp} B_R,\ \ell\ne R,\ a\mid\ell}\ell\beta_\ell}{R}. \tag*{(2)} m R = R a n R − ∑ ℓ ∈ supp B R , ℓ = R , a ∣ ℓ ℓ β ℓ . (2)
Reject unless m R m_R m R is an integer between zero and β R \beta_R β R . Assign m R m_R m R copies at R R R to the row projection from C a C_a C a and β R − m R \beta_R-m_R β R − m R to the column projection from C b C_b C b . Every other multiplicity goes to its unique projection. We now have separate nonnegative margins, including when a = b a=b a = b .
These are necessary margins. We still have to realise both of them by one quotient. Their uniqueness also follows from classical fixed-point counts. If F j ( Z ) F_j(Z) F j ( Z ) counts the fixed points of the j j j th iterate, then F j ( A X ) = F j ( A ) F j ( X ) F_j(AX)=F_j(A)F_j(X) F j ( A X ) = F j ( A ) F j ( X ) . For a ∣ j a\mid j a ∣ j , the row projection has a F j ( B ) / F j ( A ) aF_j(B)/F_j(A) a F j ( B ) / F j ( A ) fixed points; for a ∤ j a\nmid j a ∤ j it has none. These counts determine its cycles by divisor inversion [12 §2, (2-7-1)–(2-7-2)] . The local formula (2) needs only the lengths in one block.
Theorem 2.2 (Counting from the reduced ratio). Let A = C a + C b A=C_a+C_b A = C a + C b and B B B be given by successor tables. Put g = gcd ( a , b ) g=\gcd(a,b) g = g cd( a , b ) and K = min { τ ( a / g ) , τ ( b / g ) } K=\min\{\tau(a/g),\tau(b/g)\} K = min { τ ( a / g ) , τ ( b / g )} , where τ ( d ) \tau(d) τ ( d ) counts the positive divisors of d d d . There is a deterministic algorithm that counts all quotient isomorphism classes and, when the count is positive, constructs the successor table of one quotient. Each layer of its dynamic program for a block has at most ( N + 1 ) K (N+1)^K ( N + 1 ) K states, indexed by at most K K K row totals. The full algorithm takes ( N + 1 ) K + O ( 1 ) (N+1)^{K+O(1)} ( N + 1 ) K + O ( 1 ) bit operations. The lengths a , b a,b a , b may have common factors.
Proof. Read the cycles of both permutations. Form the equations and the independent blocks of Lemma 2.1 , including zero targets and rejecting a nonintegral quotient size or an unreachable target length. Interchange a , b a,b a , b if necessary so that τ ( b / g ) = K \tau(b/g)=K τ ( b / g ) = K . Both divisor counts can be computed by trial division up to N N N . For 1 ≤ t ≤ n 1\leq t\leq n 1 ≤ t ≤ n , call r = lcm ( a , t ) r=\operatorname{lcm}(a,t) r = lcm ( a , t ) its row and c = lcm ( b , t ) c=\operatorname{lcm}(b,t) c = lcm ( b , t ) its column in the block R = lcm ( a , b , t ) R=\operatorname{lcm}(a,b,t) R = lcm ( a , b , t ) . Since lcm ( r , b ) = R \operatorname{lcm}(r,b)=R lcm ( r , b ) = R ,
R / r = b / gcd ( r , b ) . R/r=b/\gcd(r,b). R / r = b / g cd( r , b ) .
Since a ∣ r a\mid r a ∣ r , the denominator is a multiple of g g g , and R / r R/r R / r divides b / g b/g b / g . For fixed R R R this divisor determines r r r . Thus there are at most τ ( b / g ) = K \tau(b/g)=K τ ( b / g ) = K row lengths. Interchanging the two axes likewise bounds the number of column lengths by τ ( a / g ) \tau(a/g) τ ( a / g ) .
Use (2) after ordering the two axes. Write ρ r \rho_r ρ r for the number of cycles required from row r r r and γ c \gamma_c γ c for the number required from column c c c . A row and a column of the same numerical length have separate quotas. A positive quota with no candidate variable on its side makes the block infeasible.
Let P P P be the set of candidate rows. Process one column at a time in any fixed order, fixing an order of variables within each column. Keep the number s r s_r s r already supplied by each row. During column c c c , let z z z be its current count and let J J J be the completed columns. If the processed quotient cycles use u u u states, the two projections have used a u au a u and b u bu b u states. Therefore
b ∑ r ∈ P r s r = a b u = a ( ∑ d ∈ J d γ d + c z ) . b\sum_{r\in P} r s_r=abu=a\left(\sum_{d\in J}d\gamma_d+cz\right). b r ∈ P ∑ r s r = ab u = a ( d ∈ J ∑ d γ d + cz ) .
The sum over completed columns is fixed at this step, so the row counters determine z z z . For a candidate period t t t try each multiplicity x t = 0 , … , ⌊ n / t ⌋ x_t=0,\ldots,\lfloor n/t\rfloor x t = 0 , … , ⌊ n / t ⌋ . Add gcd ( a , t ) x t \gcd(a,t)x_t g cd( a , t ) x t to its row and gcd ( b , t ) x t \gcd(b,t)x_t g cd( b , t ) x t to its current column. Discard a transition if it exceeds either quota. At the end of the column require z = γ c z=\gamma_c z = γ c , and after the last column require s r = ρ r s_r=\rho_r s r = ρ r for every row. This rule also applies when r = c r=c r = c .
Two prefixes at the same step with the same row counters have identical possible completions. Starting the zero state with count one, add the counts of all transitions reaching the same state. Each full vector ( x t ) (x_t) ( x t ) follows one path through the prescribed variable order and specifies one isomorphism class. Multiply the final counts of the independent blocks. The identity following (1) then gives the required size w w w without a separate counter for states.
For reconstruction, keep one predecessor and its chosen x t x_t x t for each reached state at each step. Reading back from the accepted state in each block supplies all multiplicities. Writing that many disjoint cycles gives a successor table on exactly n n n states. The number of distinct row vectors per layer is at most ∏ r ∈ P ( ρ r + 1 ) ≤ ( N + 1 ) K \prod_{r\in P}(\rho_r+1)\leq(N+1)^K ∏ r ∈ P ( ρ r + 1 ) ≤ ( N + 1 ) K . There are at most n + 1 n+1 n + 1 choices per variable and n n n variables altogether. All partial counts and products over completed blocks are bounded by ( n + 1 ) n (n+1)^n ( n + 1 ) n , the number of unrestricted choices in { 0 , … , n } n \{0,\ldots,n\}^n { 0 , … , n } n . Integer arithmetic and comparing states thus cost polynomially many bit operations per transition. Sorting transitions by destination merges them deterministically within the claimed bound, including predecessor storage and reconstruction. □
For example, take ( C 2 + C 3 ) X = 6 C 2 + 6 C 3 + 5 C 6 (C_2+C_3)X=6C_2+6C_3+5C_6 ( C 2 + C 3 ) X = 6 C 2 + 6 C 3 + 5 C 6 . Every quotient length divides six. Take the C 2 C_2 C 2 projection as the rows, of lengths two and six. While the algorithm fills its first column, of length three, the balance of states gives s 3 = s 2 + 3 s 6 s_3=s_2+3s_6 s 3 = s 2 + 3 s 6 . The two row counters thus determine all three totals. To see the resulting count, observe that the targets at two and three require x 1 + 2 x 2 = x 1 + 3 x 3 = 6 x_1 + 2x_2 = x_1 + 3x_3 = 6 x 1 + 2 x 2 = x 1 + 3 x 3 = 6 , so x 1 x_1 x 1 is either six or zero. At the shared length six, the equation is x 2 + x 3 + 5 x 6 = 5 x_2 + x_3 + 5x_6 = 5 x 2 + x 3 + 5 x 6 = 5 . Formula (2) assigns two of the five cycles of length six to the row and three to the column. If x 1 = 6 x_1 = 6 x 1 = 6 , one quotient cycle C 6 C_6 C 6 supplies all five copies through the two projections. If x 1 = 0 x_1 = 0 x 1 = 0 , the three copies of C 2 C_2 C 2 and two copies of C 3 C_3 C 3 together supply those same five cycles. The count is two. In neither case is there a further choice of how to assign the five target cycles to the projections.
There is also a route to the decision bound through integer programming. In the matrix with separate row and column quotas, cut the ordered list of variables between two positions. The prefix and suffix column spans can overlap on the rows P P P and at most the column c c c currently being filled. Every vector y y y in their intersection satisfies the same linear balance as the product columns, b ∑ r ∈ P y r = a c y c b\sum_{r\in P} y_r = a c y_c b ∑ r ∈ P y r = a c y c when c c c is present. Thus the intersection has dimension at most ∣ P ∣ ≤ K |P| \le K ∣ P ∣ ≤ K . This supplies a path decomposition of width at most K + 1 K+1 K + 1 in the convention of Fomin et al. Their Theorem 6 gives a feasibility algorithm for this order, building on Cunningham and Geelen’s approach to integer programming [9 , 14 ] . The direct recurrence also counts classes and records a witness.
Reading a table from a product of cycles
Suppose gcd ( a , b ) = 1 \gcd(a,b) = 1 g cd( a , b ) = 1 . If a quotient contains a t t t -cycle, its two contributions to B B B have lengths ℓ = lcm ( a , t ) \ell= \operatorname{lcm}(a,t) ℓ = lcm ( a , t ) and ℓ ′ = lcm ( b , t ) \ell' = \operatorname{lcm}(b,t) ℓ ′ = lcm ( b , t ) . These two lengths determine t t t through the identity
gcd ( ℓ , ℓ ′ ) = t . \gcd(\ell,\ell') = t. g cd( ℓ , ℓ ′ ) = t .
Indeed, at each prime at least one of a , b a,b a , b has exponent zero, so the smaller of the two output exponents is the exponent in t t t . With k k k distinct lengths in B B B , at most k 2 k^2 k 2 gcds have to be tried, allowing a length to be paired with itself. What remains is to choose how often each candidate occurs.
Here is a product in which those multiplicities can be read as a table. Take A = C 6 + C 35 A = C_6 + C_{35} A = C 6 + C 35 . Use rows indexed by the divisors 5 , 7 5, 7 5 , 7 of 35 35 35 and columns indexed by the divisors 2 , 3 2, 3 2 , 3 of 6 6 6 . In the cell with indices u , v u,v u , v , put the candidate quotient cycle C u v C_{uv} C uv .
Table 1.
Take one copy in each diagonal cell. The 10-cycle contributes 2 C 30 2C_{30} 2 C 30 to its row and 5 C 70 5C_{70} 5 C 70 to its column. The 21-cycle contributes 3 C 42 3C_{42} 3 C 42 and 7 C 105 7C_{105} 7 C 105 . Thus
( C 6 + C 35 ) ( C 10 + C 21 ) = 2 C 30 + 3 C 42 + 5 C 70 + 7 C 105 . (C_6 + C_{35})(C_{10} + C_{21}) = 2C_{30} + 3C_{42} + 5C_{70} + 7C_{105}. ( C 6 + C 35 ) ( C 10 + C 21 ) = 2 C 30 + 3 C 42 + 5 C 70 + 7 C 105 .
Reading from the right, the required multiplicity of C 30 C_{30} C 30 is a row sum. A copy in its first cell counts twice and a copy in its second cell counts three times. Down a column it is the row index that supplies the weight.
Lemma 3.1 (Two families of target lengths). Let a , b > 1 a,b > 1 a , b > 1 be coprime. Choose distinct proper divisors u i u_i u i of b b b and distinct proper divisors v j v_j v j of a a a . For nonnegative integers R i , S j R_i, S_j R i , S j , put
A = C a + C b , B = ∑ i R i C a u i + ∑ j S j C b v j . A = C_a + C_b,\qquad B = \sum_i R_i C_{a u_i} + \sum_j S_j C_{b v_j}. A = C a + C b , B = i ∑ R i C a u i + j ∑ S j C b v j . Quotient classes correspond bijectively to nonnegative integer tables x = ( x i j ) x = (x_{ij}) x = ( x ij ) satisfying
∑ j v j x i j = R i for each row i , ∑ i u i x i j = S j for each column j . (3) \sum_j v_j x_{ij} = R_i \quad\text{for each row } i,\qquad\sum_i u_i x_{ij} = S_j \quad\text{for each column } j. \tag*{(3)} j ∑ v j x ij = R i for each row i , i ∑ u i x ij = S j for each column j . (3) The corresponding quotient is X = ∑ i , j x i j C u i v j X = \sum_{i,j} x_{ij} C_{u_i v_j} X = ∑ i , j x ij C u i v j .
Proof. Consider any cycle C t C_t C t in a quotient. Its contribution from C a C_a C a has length divisible by a a a . This rules out every b v j bv_j b v j , since gcd ( a , b ) = 1 \gcd(a,b)=1 g cd( a , b ) = 1 and v j v_j v j is a proper divisor of a a a . Thus this length is a u i au_i a u i . Similarly the contribution from C b C_b C b has length b v j bv_j b v j . Taking the gcd recovers t = u i v j t=u_iv_j t = u i v j . The factors u i , v j u_i,v_j u i , v j are recovered from t t t by taking its gcd with b , a b,a b , a , respectively. Every cycle of every quotient therefore belongs to exactly one cell. Conversely C a C u i v j = v j C a u i C_aC_{u_iv_j}=v_jC_{au_i} C a C u i v j = v j C a u i and C b C u i v j = u i C b v j C_bC_{u_iv_j}=u_iC_{bv_j} C b C u i v j = u i C b v j . The row and column lengths are all distinct, so adding the contributions gives exactly (3).
Separating the two projections
In the last example a useful change of lengths is already visible: 6 ⋅ 6 − 35 = 1 6\cdot6-35=1 6 ⋅ 6 − 35 = 1 . Replacing 6 , 35 6,35 6 , 35 by 36 , 35 36,35 36 , 35 carries the same diagonal quotient C 10 + C 21 C_{10}+C_{21} C 10 + C 21 to the target 2 C 180 + 3 C 252 + 5 C 70 + 7 C 105 2C_{180}+3C_{252}+5C_{70}+7C_{105} 2 C 180 + 3 C 252 + 5 C 70 + 7 C 105 . The two row lengths were multiplied by six. The column lengths and the four required multiplicities stayed the same.
For an arbitrary input the first difficulty is to identify the rows. For instance, ( C 2 + C 3 ) ( C 1 + C 3 ) = C 2 + 4 C 3 + C 6 (C_2+C_3)(C_1+C_3)=C_2+4C_3+C_6 ( C 2 + C 3 ) ( C 1 + C 3 ) = C 2 + 4 C 3 + C 6 . The C 6 C_6 C 6 comes from C 2 C 3 C_2C_3 C 2 C 3 . If we called it a column because its length is divisible by three, changing 2 , 3 2,3 2 , 3 to 4 , 3 4,3 4 , 3 would give C 4 + 4 C 3 + C 6 C_4+4C_3+C_6 C 4 + 4 C 3 + C 6 . Its 22 states cannot be a product with a seven-state divisor. The total number of states in each projection tells us which assignment is possible.
Proof of Theorem A. Put D = lcm ( a , b ) D=\operatorname{lcm}(a,b) D = lcm ( a , b ) . Group the observed lengths ℓ \ell ℓ by their common label R = lcm ( D , ℓ ) R=\operatorname{lcm}(D,\ell) R = lcm ( D , ℓ ) . Both images of a quotient cycle of length t t t belong to the block B R B_R B R with R = lcm ( D , t ) R=\operatorname{lcm}(D,t) R = lcm ( D , t ) . The split in (2) either detects an impossible target or gives its required row and column multiplicities in every block. Write n R = ∣ B R ∣ / ( a + b ) n_R=|B_R|/(a+b) n R = ∣ B R ∣/ ( a + b ) for the required quotient size there.
Choosing the new divisor. Write U = a / g U=a/g U = a / g , V = b / g V=b/g V = b / g . We need positive P , Q P,Q P , Q with U P − V Q = 1 UP-VQ=1 U P − V Q = 1 and V Q ≥ 2 VQ\ge2 V Q ≥ 2 . The ( 6 , 35 ) (6,35) ( 6 , 35 ) example used P = 6 , Q = 1 P=6,Q=1 P = 6 , Q = 1 . For a uniform construction take 1 ≤ P 0 ≤ V 1\le P_0\le V 1 ≤ P 0 ≤ V with U P 0 ≡ 1 ( m o d V ) UP_0\equiv1\pmod V U P 0 ≡ 1 ( mod V ) , taking P 0 = 1 P_0=1 P 0 = 1 if V = 1 V=1 V = 1 , and put Q 0 = ( U P 0 − 1 ) / V Q_0=(UP_0-1)/V Q 0 = ( U P 0 − 1 ) / V . Set P = P 0 + 2 V P=P_0+2V P = P 0 + 2 V , Q = Q 0 + 2 U Q=Q_0+2U Q = Q 0 + 2 U and
a ′ = P a , b ′ = Q b , D ′ = lcm ( a ′ , b ′ ) = P Q D . a'=Pa,\qquad b'=Qb,\qquad D'=\operatorname{lcm}(a',b')=PQD. a ′ = P a , b ′ = Q b , D ′ = lcm ( a ′ , b ′ ) = P Q D .
Then a ′ / g = b ′ / g + 1 a'/g=b'/g+1 a ′ / g = b ′ / g + 1 , b ′ / g ≥ 2 b'/g\ge2 b ′ / g ≥ 2 , and gcd ( P , Q ) = gcd ( P , V ) = gcd ( Q , U ) = 1 \gcd(P,Q)=\gcd(P,V)=\gcd(Q,U)=1 g cd( P , Q ) = g cd( P , V ) = g cd( Q , U ) = 1 . Writing ν p ( t ) \nu_p(t) ν p ( t ) for the exponent of p p p in t t t , for every prime p ∣ P p\mid P p ∣ P we have ν p ( a ) ≥ ν p ( b ) \nu_p(a)\ge\nu_p(b) ν p ( a ) ≥ ν p ( b ) , and symmetrically for Q Q Q .
Transforming a block. If a change of divisor length introduces a prime power already forced by the block label, the quotient length must change with it. The factors below record precisely those forced changes. Let F R F_R F R be the set of primes dividing R / D R/D R / D . Let P R P_R P R and Q R Q_R Q R be the products of the full prime powers of P P P and Q Q Q , respectively, supported on F R F_R F R . Empty products are one. The mapping on quotient lengths in this block is t ↦ y = P R Q R t t\mapsto y=P_RQ_Rt t ↦ y = P R Q R t . Form B ′ B' B ′ by the following rules:
Table 2.
Add multiplicities when the new lengths coincide. For example, take A = 2 C 1 A=2C_1 A = 2 C 1 and B = 2 C 6 B=2C_6 B = 2 C 6 . Each projection must supply one C 6 C_6 C 6 . Here P = 3 , Q = 2 , R = 6 P=3,Q=2,R=6 P = 3 , Q = 2 , R = 6 , so the quotient C 6 C_6 C 6 becomes C 36 C_{36} C 36 . Its two contributions are 3 C 36 3C_{36} 3 C 36 and 2 C 36 2C_{36} 2 C 36 , giving the single observed length in the new target 5 C 36 5C_{36} 5 C 36 .
For lcm ( D , t ) = R \operatorname{lcm}(D,t)=R lcm ( D , t ) = R , the transformation follows from the identities
lcm ( a ′ , y ) = P Q R lcm ( a , t ) , gcd ( a ′ , y ) = P R gcd ( a , t ) , \operatorname{lcm}(a',y)=P Q_R\operatorname{lcm}(a,t),\qquad\gcd(a',y)=P_R\gcd(a,t), lcm ( a ′ , y ) = P Q R lcm ( a , t ) , g cd( a ′ , y ) = P R g cd( a , t ) ,
lcm ( b ′ , y ) = Q P R lcm ( b , t ) , gcd ( b ′ , y ) = Q R gcd ( b , t ) . \operatorname{lcm}(b',y)=Q P_R\operatorname{lcm}(b,t),\qquad\gcd(b',y)=Q_R\gcd(b,t). lcm ( b ′ , y ) = Q P R lcm ( b , t ) , g cd( b ′ , y ) = Q R g cd( b , t ) .
Indeed at p ∈ F R p \in F_R p ∈ F R the exponent in t t t is its exponent in R R R , strictly greater than that in either original axis. Raising it by ν p ( P Q ) \nu_p(PQ) ν p ( P Q ) keeps it above both new axes. At p ∉ F R p \notin F_R p ∈ / F R the exponent in t t t is at most that in D D D . If p ∣ P p \mid P p ∣ P then ν p ( D ) = ν p ( a ) \nu_p(D)=\nu_p(a) ν p ( D ) = ν p ( a ) , so increasing the exponent in a a a multiplies the row length by the p p p -part of P P P and leaves its multiplicity and the whole column contribution unchanged. The case p ∣ Q p \mid Q p ∣ Q is symmetric; elsewhere the exponents are unchanged. Thus every original solution has the stated image.
Recovering every quotient. Every target length transformed in block R R R has new label S = P Q R S=PQR S = P QR . At primes in F R F_R F R its original exponent is the one in R R R , and the rules add ν p ( P Q ) \nu_p(PQ) ν p ( P Q ) . At all other primes its new exponent is at most the one in D ′ = P Q D D'=PQD D ′ = P Q D . Thus the new label identifies the original block.
Which row and column can meet? A common image length is divisible by both new axes, so it equals its own label S S S . If row r r r and column c c c meet, then P Q R r = Q P R c = P Q R P_QR_r=Q_PR_c=PQR P Q R r = Q P R c = P QR , giving
r = ( Q / Q R ) R , c = ( P / P R ) R . r=(Q/Q_R)R,\qquad c=(P/P_R)R. r = ( Q / Q R ) R , c = ( P / P R ) R .
Both r r r and c c c divide R R R . Hence r = c = R r=c=R r = c = R , P R = P P_R=P P R = P and Q R = Q Q_R=Q Q R = Q . Conversely, under these conditions positive quotas on both sides at R R R do meet at S S S .
Put E = P R Q R E=P_RQ_R E = P R Q R in any block. The prescribed image rows have a ′ E n R a' E n_R a ′ E n R states and the columns have b ′ E n R b' E n_R b ′ E n R states. Thus any quotient has E n R E n_R E n R states in this block. Formula (2) applied to the new axes forces the prescribed share at S S S , even if one side contributes zero.
Now take a cycle of length y y y in any quotient of B ′ B' B ′ . Its label lcm ( D ′ , y ) = S \operatorname{lcm}(D',y)=S lcm ( D ′ , y ) = S determines R R R . By the forced split its two projection lengths are P Q R r P_QR_r P Q R r and Q P R c Q_PR_c Q P R c for some r , c ∣ R r,c\mid R r , c ∣ R . Since y y y divides both lengths,
y ∣ R gcd ( P Q R , Q P R ) = E R , y\mid R\gcd(P_QR,Q_PR)=ER, y ∣ R g cd( P Q R , Q P R ) = E R ,
where the equality uses gcd ( P / P R , Q / Q R ) = 1 \gcd(P/P_R,Q/Q_R)=1 g cd( P / P R , Q / Q R ) = 1 . For each p ∈ F R p\in F_R p ∈ F R , the exponent in S S S exceeds that in D ′ D' D ′ , so ν p ( y ) = ν p ( R ) + ν p ( E ) \nu_p(y)=\nu_p(R)+\nu_p(E) ν p ( y ) = ν p ( R ) + ν p ( E ) . Hence E ∣ y E\mid y E ∣ y , and t = y / E t=y/E t = y / E divides R R R with the full exponent of R R R at every p ∈ F R p\in F_R p ∈ F R . At all other primes D D D and R R R have the same exponent. Thus lcm ( D , t ) = R \operatorname{lcm}(D,t)=R lcm ( D , t ) = R . In a block where the two sides meet, this inverse simply divides every quotient length by P Q PQ P Q .
The four identities above now recover the contributions of C t C_t C t . Within a block each side scales its lengths by a fixed factor, so dividing its image multiplicities by P R P_R P R on the row side and by Q R Q_R Q R on the column side recovers all the old margins. The decoded cycles therefore give A X = B AX=B A X = B . Each keeps its multiplicity, and mapping t t t forward gives back y y y . The maps are inverse on quotient classes.
Bit complexity. Let L L L be the length of the binary cycle lists. Extended Euclid computes P 0 P_0 P 0 , and P ≤ 3 V P\le3V P ≤ 3 V , Q ≤ 3 U Q\le3U Q ≤ 3 U . No factoring of a binary axis or target period is needed. For example,
P R = gcd ( P , ( R / D ) ⌊ log 2 ( 2 P ) ⌋ ) P_R=\gcd\left(P,\left(R/D\right)^{\lfloor\log_2(2P)\rfloor}\right) P R = g cd( P , ( R / D ) ⌊ l o g 2 ( 2 P )⌋ )
is computed by modular powering, and similarly for Q R Q_R Q R . There are only polynomially many periods and blocks. The displayed formulas use polynomial-bit integers throughout. A quotient can be mapped or decoded in time polynomial in the input and its own list. On a rejected input output B ′ = C 1 B'=C_1 B ′ = C 1 with the new divisor, which admits no quotient.
On explicit inputs let N = ∣ A ∣ + ∣ B ∣ N=|A|+|B| N = ∣ A ∣ + ∣ B ∣ . Reading their cycles gives L = O ( N log ( 2 N ) ) L=O(N\log(2N)) L = O ( N log ( 2 N )) . A new row’s number of states is its old number times P P R Q R P P_RQ_R P P R Q R , and a column’s number is its old number times Q P R Q R Q P_RQ_R Q P R Q R . Equivalently, if the margin split passed,
∣ B ′ ∣ = ( P a + Q b ) ∑ R P R Q R n R . |B'|=(Pa+Qb)\sum_R P_RQ_R n_R. ∣ B ′ ∣ = ( P a + Q b ) R ∑ P R Q R n R .
Thus the two output permutations have at most P Q max ( P , Q ) N = O ( N 4 ) PQ\max(P,Q)N=O(N^4) P Q max ( P , Q ) N = O ( N 4 ) states, independently of feasibility. Writing their successor tables and, when requested, expanding the cycles of a witness take polynomial bit time.
With just one divisor length, each candidate contributes to a single target length. One can solve the resulting equations separately in polynomial time, even in binary [10 Theorems 3 and 4] . Appendix B gives the criterion and a short certificate for general binary division. With two lengths the same entry x i j x_{ij} x ij must help meet both a row sum and a column sum. We now use that requirement to make several occurrences of an edge colour agree.
How a table records an edge-colouring
Take a nonempty simple cubic graph G ′ G' G ′ . To colour its edges with three colours, we must give the two ends of each edge the same colour, and use each colour once at each vertex. We will make a row choose a colour and let the columns check who else has chosen it.
We want each element to occur in exactly three triples. Starting with one triple ( v , w , e ) (v,w,e) ( v , w , e ) per edge e = v w e=vw e = v w nearly works. Each vertex occurs three times and each edge just once. Give every vertex v v v three copies v 0 v_0 v 0 , v 1 v_1 v 1 , v 2 v_2 v 2 , one per layer. Within layer ℓ \ell ℓ all three incident edges use the same v ℓ v_\ell v ℓ . Keep a single element e e e for the edge across all layers. The triples are now
h = ( v ℓ , w ℓ , e ) , ℓ = 0 , 1 , 2. h=(v_\ell,w_\ell,e), \qquad\ell=0,1,2. h = ( v ℓ , w ℓ , e ) , ℓ = 0 , 1 , 2.
Each element t t t , whether it is a vertex copy or an edge, belongs to exactly three triples. Require the triples through t t t to have all three colours. In layer 0 this gives an edge-colouring of G ′ G' G ′ . Conversely, any proper edge-colouring κ \kappa κ gives each triple ( v ℓ , w ℓ , e ) (v_\ell,w_\ell,e) ( v ℓ , w ℓ , e ) the colour κ ( e ) + ℓ m o d 3 \kappa(e)+\ell\bmod3 κ ( e ) + ℓ mod 3 . Thus the extra layers cost nothing for existence. They will matter when we count the tables in § 7 .
A row chooses a colour. In (3) a row sum uses the column weights. We want the row for h = ( v ℓ , w ℓ , e ) h=(v_\ell,w_\ell,e) h = ( v ℓ , w ℓ , e ) to select one column for each of its elements, all of the same colour. Give each element t t t a symbol B t B_t B t for its base weight, and give each vertex v v v a symbol D v D_v D v . Initially treat different symbols as independent. Define
Δ v ℓ = D v , Δ e = − D v − D w ( e = v w ) , X t , c = B t + σ c Δ t , ( σ 0 , σ 1 , σ 2 ) = ( 0 , 1 , 3 ) . \Delta_{v_\ell}=D_v,\qquad\Delta_e=-D_v-D_w\ (e=vw),\qquad X_{t,c}=B_t+\sigma_c\Delta_t,\qquad(\sigma_0,\sigma_1,\sigma_2)=(0,1,3). Δ v ℓ = D v , Δ e = − D v − D w ( e = v w ) , X t , c = B t + σ c Δ t , ( σ 0 , σ 1 , σ 2 ) = ( 0 , 1 , 3 ) .
Suppose the row selects its three X X X -columns at colours i , j , c i,j,c i , j , c , respectively. After subtracting its target ∑ t ∈ h B t \sum_{t\in h}B_t ∑ t ∈ h B t , the excess weight is
( σ i − σ c ) D v + ( σ j − σ c ) D w . (4) (\sigma_i-\sigma_c)D_v+(\sigma_j-\sigma_c)D_w. \tag*{(4)} ( σ i − σ c ) D v + ( σ j − σ c ) D w . (4)
For example, choosing colour 2 at both ends and colour 1 at the edge leaves 2 D v + 2 D w 2D_v+2D_w 2 D v + 2 D w . Equality with the target requires both coefficients to vanish, so all three choices must agree.
One triple fills a pair of columns. Give column X t , c X_{t,c} X t , c a partner of weight Y t , c = H t − X t , c Y_{t,c}=H_t-X_{t,c} Y t , c = H t − X t , c , where H t H_t H t is a new symbol for element t t t . A row that visits both columns once receives exactly H t H_t H t .
A triple h h h has seven rows. Four visit all three elements of h h h at its chosen colour c c c . The other three are indexed by the elements of h h h . At a given element t t t , only its own incidence row F h t F_{ht} F h t joins the four shared rows. The five rows split as follows.
Table 1 (PDF p. 10).
Each named row contributes one copy to its column. If each column accepts exactly one such filling, the three triples at t t t must choose different colours.
To realise these sums, give the pair P h P_h P h , G h G_h G h weights p h p_h p h , g h g_h g h with sum L h = p h + g h L_h = p_h + g_h L h = p h + g h . Give R h R_h R h , K h K_h K h the same total weight in a different way, using a fresh symbol r h r_h r h . Finally, give both columns at ( t , c ) (t,c) ( t , c ) target T t T_t T t . The incidence row F h t F_{ht} F h t must supply the missing weight T t − L h T_t - L_h T t − L h . The resulting row data are
Table 3.
Passing from symbols to integers. Two conditions will make every numerical filling visible in this description. First we place the row weights close to W W W and the column weights close to V V V , for positive scales W W W , V V V . We use the bounds
∣ p h − W ∣ , ∣ g h − W ∣ , ∣ r h − W ∣ ≤ 10 − 4 W , ∣ T t − 3 W ∣ ≤ 3 ⋅ 10 − 4 W , \left|p_h-W\right|,\ \left|g_h-W\right|,\ \left|r_h-W\right| \le10^{-4}W,\qquad\left|T_t-3W\right| \le3\cdot10^{-4}W, ∣ p h − W ∣ , ∣ g h − W ∣ , ∣ r h − W ∣ ≤ 1 0 − 4 W , ∣ T t − 3 W ∣ ≤ 3 ⋅ 1 0 − 4 W ,
∣ B t − V ∣ , ∣ H t − 2 V ∣ ≤ 10 − 4 V , 0 < D v < 10 − 5 V . \left|B_t-V\right|,\ \left|H_t-2V\right| \le10^{-4}V,\qquad0<D_v<10^{-5}V. ∣ B t − V ∣ , ∣ H t − 2 V ∣ ≤ 1 0 − 4 V , 0 < D v < 1 0 − 5 V .
Substitution puts each row weight between 0.999 W 0.999W 0.999 W and 1.001 W 1.001W 1.001 W , and each column weight between 0.999 V 0.999V 0.999 V and 1.001 V 1.001V 1.001 V . Column targets lie within 0.003 W 0.003W 0.003 W of 3 W 3W 3 W . Main row targets lie within 0.003 V 0.003V 0.003 V of 3 V 3V 3 V , and incidence row targets within 0.001 V 0.001V 0.001 V of 2 V 2V 2 V . Thus every column and main row must use exactly three copies, and every incidence row exactly two. This holds for each equation on its own, including in a table with no solution.
Second, the values assigned to distinct symbols on the same side must satisfy no unintended relation among the few terms in a single margin. Call the symbols H H H -independent if ∑ α γ α z α = 0 \sum_\alpha\gamma_\alpha z_\alpha=0 ∑ α γ α z α = 0 with integer coefficients and ∑ α ∣ γ α ∣ ≤ H \sum_\alpha|\gamma_\alpha|\le H ∑ α ∣ γ α ∣ ≤ H forces every γ α = 0 \gamma_\alpha=0 γ α = 0 . A row equation adds at most three column weights. For example, for e = v w e=vw e = v w the weight Y e , 2 = H e − B e + 3 D v + 3 D w Y_{e,2}=H_e-B_e+3D_v+3D_w Y e , 2 = H e − B e + 3 D v + 3 D w has total absolute coefficient 8, the largest on that axis. Subtracting a row target adds at most 6, so 3 ⋅ 8 + 6 = 30 3\cdot8+6=30 3 ⋅ 8 + 6 = 30 suffices for the column symbols. A column equation adds three row weights, each of norm at most 3 (for example T t − p h − g h T_t-p_h-g_h T t − p h − g h ), and subtracts the single symbol T t T_t T t . This gives 3 ⋅ 3 + 1 = 10 3\cdot3+1=10 3 ⋅ 3 + 1 = 10 for the row symbols. Collect repeated symbols first.
Lemma 4.1. Under the scale bounds above, 30-independence of the column symbols and 10-independence of the row symbols, the feasible tables are in bijection with the colourings of the triples that use every colour at each element. Their entries are all 0 or 1. In particular a table exists if and only if G ′ G' G ′ is properly 3-edge-colourable.
Proof. First read the rows. In P h P_h P h or G h G_h G h , any Y-column would contribute a positive H H H -coefficient, absent from the target. The B B B -coefficients then force one X-column for each element of h h h . Equation (4) forces them to have one colour, since the endpoints are distinct. In R h R_h R h or K h K_h K h the three H H H -coefficients force one Y Y Y per element. Cancelling the H H H ’s leaves the same colour equation. Finally F h t F_{ht} F h t must use one Y t , c Y_{t,c} Y t , c to obtain H t H_t H t and one X t , i X_{t,i} X t , i to cancel − B t -B_t − B t . Their sum is H t H_t H t precisely when i = c i=c i = c .
Next read a column at t t t . Its target T t T_t T t requires exactly one incidence row F h t F_{ht} F h t for some h h h containing t t t . The remaining two rows must supply p h + g h p_h+g_h p h + g h . If either is K h ′ K_{h'} K h ′ , its − r h ′ -r_{h'} − r h ′ forces R h ′ R_{h'} R h ′ and the p , g p,g p , g -coefficients give h ′ = h h'=h h ′ = h . Otherwise the only pair is P h P_h P h , G h G_h G h . Hence the column uses three distinct rows and its occupied entries are all 1.
Now follow a single P h P_h P h . It chooses the same colour c c c at all three elements. Each of its columns requires G h , F h t G_h,F_{ht} G h , F h t alongside it. In turn F h t F_{ht} F h t enters Y t , c Y_{t,c} Y t , c and forces R h , K h R_h,K_h R h , K h there. This is the displayed filling, and each X t , c X_{t,c} X t , c admits exactly one triple. Conversely, given a colouring of the triples, put this filling into the two columns for each incidence at its chosen colour. Each column receives exactly one triple and each row meets its target. The two constructions are inverse, since the colour of each triple specifies every occupied cell in its rows.
Encoding the table by two binary cycle lengths
Theorem 5.1. For binary lists of cycle lengths and multiplicities, division is NP-complete under polynomial-time many-one reductions, even when A = C a + C b A = C_a + C_b A = C a + C b consists of two coprime cycles with a , b > 1 a,b > 1 a , b > 1 . In the resulting table each margin equation allows at most three copies.
Proof. Membership in NP is Lemma B.1. For hardness take G ′ = G G' = G G ′ = G in Lemma 4.1, where G G G is a nonempty instance of Holyer’s NP-complete problem of three-edge-colourability of simple cubic graphs [16 ] . To turn its table into a division instance, we take b b b to be the lcm of the row weights and a a a the lcm of the column weights, as in Lemma 3.1. We choose the rows first. Once b b b is known, making each column weight 1 modulo b b b ensures that a a a and b b b are coprime.
The row weights determine b b b . Let s = ∣ V ( G ) ∣ + ∣ E ( G ) ∣ s = |V(G)| + |E(G)| s = ∣ V ( G ) ∣ + ∣ E ( G ) ∣ . Choose a base Q = 1024 Q = 1024 Q = 1024 , and reserve a different low digit j j j for each of the J r = O ( s ) J_r = O(s) J r = O ( s ) row symbols. For 0 ≤ j < J r 0 \le j < J_r 0 ≤ j < J r , with W 0 = Q J r + 3 W_0 = Q^{J_r+3} W 0 = Q J r + 3 , assign the value
c W 0 + Q j , c = 1 , 1 , 1 , 3 for p h , g h , r h , T t . (5) cW_0 + Q^j, \qquad c = 1,1,1,3 \quad\text{for } p_h,g_h,r_h,T_t. \tag*{(5)} c W 0 + Q j , c = 1 , 1 , 1 , 3 for p h , g h , r h , T t . (5)
The high term puts the symbol at its prescribed scale and the low digit identifies it. In a zero relation of norm at most 30, the low terms have absolute sum at most 30 Q J r − 1 < W 0 30Q^{J_r-1} < W_0 30 Q J r − 1 < W 0 . Hence the high terms cancel. If any low term survived, division by the least occupied power of Q Q Q and reduction modulo Q Q Q would force its nonzero coefficient of absolute value at most 30 to be divisible by 1024.
Set b = lcm i u i b = \operatorname{lcm}_i u_i b = lcm i u i over the row weights. Distinct rows have different formal weights, and their differences have norm at most 6, so their values are distinct. All lie in [ 0.999 W 0 , 1.001 W 0 ] [0.999W_0, 1.001W_0] [ 0.999 W 0 , 1.001 W 0 ] . There are at least two, and no one can be a multiple of a smaller one in this range. They are therefore all proper divisors of b b b .
The column weights must be coprime to b b b . We arrange that every column weight is 1 modulo b b b . To do so give B t , H t , D v B_t,H_t,D_v B t , H t , D v residues 1, 2, 0, respectively. Both X t , c = B t + σ c Δ t X_{t,c} = B_t + \sigma_c\Delta_t X t , c = B t + σ c Δ t and Y t , c = H t − X t , c Y_{t,c} = H_t - X_{t,c} Y t , c = H t − X t , c then have the desired residue. The full values use distinct digit positions 0 ≤ j < J c 0 \le j < J_c 0 ≤ j < J c , where J c = O ( s ) J_c = O(s) J c = O ( s ) . With V 0 = Q J c + 3 V_0 = Q^{J_c+3} V 0 = Q J c + 3 , they are
b ( c V 0 + Q j ) + c , c = 1 , 2 , 0 for B t , H t , D v . (6) b(cV_0 + Q^j) + c, \qquad c = 1,2,0 \quad\text{for } B_t,H_t,D_v. \tag*{(6)} b ( c V 0 + Q j ) + c , c = 1 , 2 , 0 for B t , H t , D v . (6)
These values meet the scale bounds with V = b V 0 V = bV_0 V = b V 0 . In any tested relation the sum of the final offsets has absolute value at most 60 < b < b < b . Reduction modulo b b b forces this sum to vanish. Dividing the remaining equality by b b b gives the same digit argument as on the row side. The formal column weights are distinct, and the norm of their pairwise differences is at most 16, so the numerical weights are distinct. Again the scale bounds make them proper divisors of their lcm a a a . As each weight is 1 modulo b b b , we have gcd ( a , b ) = 1 \gcd(a,b) = 1 g cd( a , b ) = 1 .
Form the target B B B of Lemma 3.1 from these weights and their row and column targets. That lemma and Lemma 4.1 give the required equivalence. It remains to pay for writing a , b a,b a , b in binary. Each row weight has O ( s ) O(s) O ( s ) bits, so bounding the lcm by the product gives log b = O ( s 2 ) \log b = O(s^2) log b = O ( s 2 ) . Each column weight then has O ( s 2 ) O(s^2) O ( s 2 ) bits, giving log a = O ( s 3 ) \log a = O(s^3) log a = O ( s 3 ) . There are O ( s ) O(s) O ( s ) target terms and the pair of cycle lists uses O ( s 4 ) O(s^4) O ( s 4 ) bits altogether. The digit assignments, gcds and lcms are computable in polynomial time. □ \square □
Writing the two permutations explicitly
The binary reduction assigns one digit position to every name in the table. A cycle length with O ( s 3 ) O(s^3) O ( s 3 ) bits fits in that encoding, but writing out its successors could take 2 O ( s 3 ) 2^{O(s^3)} 2 O ( s 3 ) steps. To obtain a quasipolynomial bound we must control the values of the two cycle lengths. Each is the least common multiple of a whole family of weights. We give the vertices binary addresses and route each edge through a sequence of addresses, changing one bit at a time. The unchanged bits will supply common factors. The two-bit example below shows how this keeps the lcm small.
Theorem 6.1. Let G G G be a nonempty simple cubic graph and s = ∣ V ( G ) ∣ + ∣ E ( G ) ∣ s = |V(G)|+|E(G)| s = ∣ V ( G ) ∣ + ∣ E ( G ) ∣ . In deterministic time exp ( O ( log 3 ( s + 2 ) ) ) \exp(O(\log^3(s+2))) exp ( O ( log 3 ( s + 2 ))) one can write successor tables for A = C a + C b A = C_a+C_b A = C a + C b and a permutation B B B , with a , b > 1 a,b > 1 a , b > 1 and gcd ( a , b ) = 1 \gcd(a,b) = 1 g cd( a , b ) = 1 , such that A X ≅ B AX \cong B A X ≅ B is solvable exactly when G G G has a proper three-edge-colouring. Each individual margin equation in the construction still allows at most three copies.
This bound already proves the quasipolynomial comparison in Theorem 1.1 (ii). For part (iii), Appendix D keeps the same graph and changes the integers assigned to its addresses.
Putting the endpoints of an edge close together
Consider the weight T t − p h − g h T_t-p_h-g_h T t − p h − g h of the auxiliary row for t ∈ h t \in h t ∈ h . The name T t T_t T t belongs to an element and p h , g h p_h,g_h p h , g h belong to a triple. Suppose we could put these names at the same binary address or at two addresses differing in one bit. If the multiplier for address x x x were a product of one factor per bit, flipping one bit would leave all the other factors common to the two terms. This is our reason for first modifying the graph.
Number the vertices and give each edge its own nonzero index. Store a vertex index and an edge index in two registers of d = O ( log ( s + 2 ) ) d = O(\log(s+2)) d = O ( log ( s + 2 )) bits in total. Represent vertex v v v by ( v , 0 ) (v,0) ( v , 0 ) . Orient an edge e = v w e = vw e = v w by vertex order and route it through the addresses
( v , 0 ) ⟶ ( v , e ) ⟶ ( w , e ) ⟶ ( w , 0 ) . (v,0) \longrightarrow(v,e) \longrightarrow(w,e) \longrightarrow(w,0). ( v , 0 ) ⟶ ( v , e ) ⟶ ( w , e ) ⟶ ( w , 0 ) .
Each arrow flips the differing bits of one register in increasing order. At each internal address on the route insert a private copy of K 4 K_4 K 4 with one edge deleted. Use its two degree-two vertices to join it to the previous and next parts. Copies on different routes stay separate even when they occupy the same address.
Such a copy transmits the colour of the original edge. Indeed, each colour occurs at four vertex incidences. Internal edges account for an even number, so the two external edges must have the same colour. Every choice of this common colour extends across the copy by colouring the three perfect matchings of K 4 K_4 K 4 and deleting the designated edge. This is the diamond used in [6 proof of Theorem 3.1] . Thus the new graph G ′ G' G ′ is simple, cubic and three-edge-colourable exactly when G G G is. It has O ( s d ) O(sd) O ( s d ) vertices.
Each address has bounded occupancy. An address ( i , 0 ) (i,0) ( i , 0 ) contains at most the original vertex i i i . At ( i , j ) (i,j) ( i , j ) with j ≠ 0 j \ne0 j = 0 , at most three incident edges of i i i contribute an outer segment, and only edge j j j can contribute a middle segment. Each such segment visits the address at most once, giving at most four copies or sixteen vertices. Give all four vertices of a diamond the address where it was inserted. An edge of G ′ G' G ′ now joins vertices at equal addresses or at addresses one bit apart. Number the new vertices and choose the lower-numbered endpoint of each edge as its owner. Put the names attached to v ℓ v_\ell v ℓ and D v D_v D v at v v v , and those attached to an edge and its triples at its owner. Only a bounded number of names share an address. Every weight in Lemma 4.1 uses one address or two neighbouring addresses. The targets need only have short binary descriptions, since only the weights enter the lcms.
Multipliers for the addresses
A binary address x x x will also denote the set of bits equal to one. Its multiplier U ( x ) U(x) U ( x ) should keep short relations among different addresses distinguishable and should keep all the names in their prescribed size ranges. We also prescribe a modulus M M M . Having U ( x ) ≡ 1 ( m o d M ) U(x) \equiv1 \pmod M U ( x ) ≡ 1 ( mod M ) will let us choose the two axis lcms to be coprime. A symbol at x x x will have value μ U ( x ) \mu U(x) μU ( x ) with ∣ μ ∣ ≤ C |\mu| \le C ∣ μ ∣ ≤ C . Collecting at most H H H signed occurrences therefore gives address coefficients whose absolute values sum to at most H C HC H C .
Lemma 6.2 (Address multipliers). Fix H = 30 H = 30 H = 30 . For positive integers d d d , M M M , C C C one can choose positive integers q q q , z 0 , … , z d − 1 z_0,\ldots,z_{d-1} z 0 , … , z d − 1 , with q ≤ z i < 2 q q \le z_i < 2q q ≤ z i < 2 q and log q = O ( d + log ( 2 M ) + log ( 2 C ) ) \log q = O(d + \log(2M) + \log(2C)) log q = O ( d + log ( 2 M ) + log ( 2 C )) , such that
U ( x ) = q d − ∣ x ∣ ∏ i ∈ x z i , U ( x ) ≡ 1 ( m o d M ) , 1 ≤ U ( x ) q d < 1 + 10 − 7 . U(x)=q^{d-|x|}\prod_{i\in x}z_i,\qquad U(x)\equiv1\pmod{M},\qquad1\le\frac{U(x)}{q^d}<1+10^{-7}. U ( x ) = q d − ∣ x ∣ i ∈ x ∏ z i , U ( x ) ≡ 1 ( mod M ) , 1 ≤ q d U ( x ) < 1 + 1 0 − 7 .
If integers b x b_x b x have at most H H H nonzero entries and ∑ x ∣ b x ∣ ≤ H C \sum_x|b_x|\le HC ∑ x ∣ b x ∣ ≤ H C , then ∑ x b x U ( x ) = 0 \sum_xb_xU(x)=0 ∑ x b x U ( x ) = 0 forces every b x = 0 b_x=0 b x = 0 . The integers q , z i q,z_i q , z i are computable in time polynomial in d d d , log ( 2 M ) \log(2M) log ( 2 M ) and log ( 2 C ) \log(2C) log ( 2 C ) .
Appendix A constructs these multipliers. We first use the product formula for U ( x ) U(x) U ( x ) to see how much it saves.
Why the weights have a small common multiple. With two bits, for instance, the addresses { 0 } \{0\} { 0 } and { 0 , 1 } \{0,1\} { 0 , 1 } have multipliers q z 0 qz_0 q z 0 and z 0 z 1 z_0z_1 z 0 z 1 . A linear combination factors as z 0 ( c 1 q + c 2 z 1 ) z_0(c_1q+c_2z_1) z 0 ( c 1 q + c 2 z 1 ) . Only the term in parentheses depends on the bit that changed. In general every U ( x ) U(x) U ( x ) divides D 0 = q d ∏ i < d z i D_0=q^d\prod_{i<d}z_i D 0 = q d ∏ i < d z i . A weight at one address is c U ( x ) cU(x) c U ( x ) . When a weight uses x x x and x ∪ { i } x\cup\{i\} x ∪ { i } with i ∉ x i\notin x i ∈ / x , we can factor out the contribution from every unchanged bit and obtain
c 1 U ( x ) + c 2 U ( x ∪ { i } ) = U ( x ) q ( c 1 q + c 2 z i ) , U ( x ) q ∣ D 0 . c_1U(x)+c_2U(x\cup\{i\})=\frac{U(x)}{q}(c_1q+c_2z_i),\qquad\frac{U(x)}{q}\mid D_0. c 1 U ( x ) + c 2 U ( x ∪ { i }) = q U ( x ) ( c 1 q + c 2 z i ) , q U ( x ) ∣ D 0 .
Suppose for the moment that c , c 1 , c 2 c,c_1,c_2 c , c 1 , c 2 range over bounded sets of integers. For positive weights, all the residual factors c c c and c 1 q + c 2 z i c_1q+c_2z_i c 1 q + c 2 z i that occur are positive. There are O ( 1 ) O(1) O ( 1 ) possibilities for the first kind and O ( d ) O(d) O ( d ) for the second, each with O ( log q ) O(\log q) O ( log q ) bits. Multiplying D 0 D_0 D 0 by all distinct residual factors gives a common multiple. Thus the logarithm of the axis lcm is O ( d log q ) O(d\log q) O ( d log q ) , regardless of how many addresses the graph uses.
Choosing the two coprime cycle lengths
Proof of Theorem 6.1. At each address number the names on each axis by distinct slots j = 0 , 1 , … j=0,1,\ldots j = 0 , 1 , … . We can reuse slot numbers at different addresses. If J r , J c J_r,J_c J r , J c are the maximum slot counts on the two axes, both are bounded independently of s s s . Put W 0 = 1024 J r + 3 W_0=1024J_r+3 W 0 = 1024 J r + 3 and V 0 = 1024 J c + 3 V_0=1024J_c+3 V 0 = 1024 J c + 3 . Each name will receive its slot coefficient multiplied by the U ( x ) U(x) U ( x ) of its address. We choose the coefficients and the moduli in the following order.
Row coefficients. Give a row name the coefficient ρ = c W 0 + 1024 j \rho=cW_0+1024j ρ = c W 0 + 1024 j , where c = 1 c=1 c = 1 for p , g , r p,g,r p , g , r and c = 3 c=3 c = 3 for T T T . Temporarily set all address multipliers to one. Call the row weights calculated this way u ˉ i \bar{u}_i u ˉ i , and let R = lcm i u ˉ i R=\operatorname{lcm}_i\bar{u}_i R = lcm i u ˉ i . For instance an auxiliary row gives ρ ( T t ) − ρ ( p h ) − ρ ( g h ) \rho(T_t)-\rho(p_h)-\rho(g_h) ρ ( T t ) − ρ ( p h ) − ρ ( g h ) . Each u ˉ i \bar{u}_i u ˉ i differs from W 0 W_0 W 0 by at most 3 ⋅ 1024 J r − 1 3\cdot1024^{J_r-1} 3 ⋅ 102 4 J r − 1 , so it exceeds 60. The bounded slot count gives an absolute bound on the set of possible u ˉ i \bar{u}_i u ˉ i , hence on R R R . This preliminary R R R lets us finish the columns first. We will make their lcm a a a coprime to R R R , then arrange that the final row weights agree with the preliminary ones modulo a a a .
Column weights and the first lcm. Give a column name the coefficient ν = R ( c V 0 + 1024 j ) + c \nu=R(cV_0+1024j)+c ν = R ( c V 0 + 1024 j ) + c , with c = 1 , 2 , 0 c=1,2,0 c = 1 , 2 , 0 for B t , H t , D v B_t,H_t,D_v B t , H t , D v , respectively. Apply Lemma 6.2 with C c = max ν C_c=\max\nu C c = max ν as C C C and M = R M=R M = R . At address x x x take the name’s value to be ν U ( x ) \nu U(x) ν U ( x ) , including the offset + c +c + c in the multiplier ν \nu ν . The names B t , H t , D v B_t,H_t,D_v B t , H t , D v retain residues 1 , 2 , 0 1,2,0 1 , 2 , 0 modulo R R R . Consequently both X t , c X_{t,c} X t , c and Y t , c Y_{t,c} Y t , c are one modulo R R R . Their lcm a a a is coprime to R R R .
Row weights and the second lcm. Now use Lemma 6.2 with C r = max ρ C_r=\max\rho C r = max ρ and M = a M=a M = a , and take a row name’s value to be ρ U ( x ) \rho U(x) ρ U ( x ) with these new multipliers. Each row weight satisfies u i ≡ u ˉ i ( m o d a ) u_i\equiv\bar{u}_i\pmod a u i ≡ u ˉ i ( mod a ) . Since u ˉ i ∣ R \bar{u}_i\mid R u ˉ i ∣ R and gcd ( a , R ) = 1 \gcd(a,R)=1 g cd( a , R ) = 1 , we have gcd ( a , u i ) = 1 \gcd(a,u_i)=1 g cd( a , u i ) = 1 for every i i i . Their lcm b b b is therefore coprime to a a a .
To apply the table construction we also need its independence and scale conditions. In a short relation, first collect all names at the same address. Lemma 6.2 separates those address coefficients. Within one address the low digits then separate the individual names, just as in the binary encoding. The estimate U ( x ) / q d < 1 + 10 − 7 U(x)/q^d<1+10^{-7} U ( x ) / q d < 1 + 1 0 − 7 keeps the values in the required intervals. Appendix A checks these bounds with the full coefficients, including the column offsets. It follows that on either axis the weights are distinct and the largest is less than twice the smallest. With at least two weights, all are proper divisors of their lcm. Each edge of G ′ G' G ′ contributes a column of colour zero and a row from layer zero. Thus both τ ( a ) \tau(a) τ ( a ) and τ ( b ) \tau(b) τ ( b ) are at least ∣ E ( G ′ ) ∣ |E(G')| ∣ E ( G ′ ) ∣ , so the parameter in Theorem 2.2 grows with the graph. Lemmas 3.1 and 4.1 now apply.
Write q c , q r q_c,q_r q c , q r for the two values of q q q . Both C c C_c C c and C r C_r C r are bounded by absolute constants. Each weight uses a bounded number of slot coefficients, so the integers c , c 1 , c 2 c,c_1,c_2 c , c 1 , c 2 in the common-multiple calculation above have the promised bounded ranges. The column choice M = R M=R M = R gives log q c = O ( d ) \log q_c=O(d) log q c = O ( d ) and log a = O ( d 2 ) \log a=O(d^2) log a = O ( d 2 ) . The row choice M = a M=a M = a gives log q r = O ( d + log a ) = O ( d 2 ) \log q_r=O(d+\log a)=O(d^2) log q r = O ( d + log a ) = O ( d 2 ) and then log b = O ( d 3 ) \log b=O(d^3) log b = O ( d 3 ) . All the weights and targets have O ( d 3 ) O(d^3) O ( d 3 ) bits as well. On every input graph the number of states to write is exactly
N = a + b + ∑ i R i a u i + ∑ j S j b v j . N=a+b+\sum_i R_i a u_i+\sum_j S_j b v_j. N = a + b + i ∑ R i a u i + j ∑ S j b v j .
For instance, row i i i prescribes R i R_i R i cycles of length a u i a u_i a u i . The state count therefore applies even if no table is feasible. There are O ( s d ) O(sd) O ( s d ) terms, each with O ( d 3 ) O(d^3) O ( d 3 ) bits, so N ≤ exp ( O ( log 3 ( s + 2 ) ) ) N\leq\exp(O(\log^3(s+2))) N ≤ exp ( O ( log 3 ( s + 2 ))) . The routing and all the binary arithmetic take time polynomial in s s s . For each output cycle, list successive state indices and then the initial index. Writing the two successor tables takes O ( N log ( 2 N ) ) O(N\log(2N)) O ( N log ( 2 N )) bit operations, as required.
Proof of the representation comparison and Theorem 1.1(ii). The comparison for C 2 + C b C_2+C_b C 2 + C b follows from Theorem 7.1 with h = 1 h=1 h = 1 , q = 2 q=2 q = 2 and Theorem 2.2 with K = 2 K=2 K = 2 . Theorem 5.1 gives binary hardness with the additional three-copy bound on each margin. For explicit inputs D 2 ∈ N P D_2\in\mathrm{NP} D 2 ∈ NP , since one may guess a permutation on n n n states and verify the product by comparing its cycle lengths with those of B B B . Thus N P ⊆ Q P \mathrm{NP}\subseteq\mathrm{QP} NP ⊆ QP implies D 2 ∈ Q P D_2\in\mathrm{QP} D 2 ∈ QP . Conversely, SAT reduces in polynomial time to three-edge-colourability of simple cubic graphs [16 ] . Theorem 6.1 reduces this problem to D 2 D_2 D 2 in deterministic quasipolynomial time, including the time to write the successor tables. A quasipolynomial algorithm for D 2 D_2 D 2 would give one for SAT, since composing two such bounds again gives quasipolynomial time. This proves (ii). Under N P ⊈ Q P \mathrm{NP}\not\subseteq\mathrm{QP} NP ⊆ QP we have P ≠ N P \mathrm{P}\ne\mathrm{NP} P = NP , so (i) excludes NP-hardness and (ii) excludes even membership in QP.
Counting quotients in binary cycle lists
Take A = C 2 + C b A=C_2+C_b A = C 2 + C b with b > 1 b>1 b > 1 odd, and let u u u be a proper divisor of b b b . The first cycle of A A A gives the same product with 2 C u 2C_u 2 C u as with C 2 u C_{2u} C 2 u , namely 2 C 2 u 2C_{2u} 2 C 2 u . The interval construction for explicit division uses the same identity with a prime-length cycle [20 Section 2, p. 4] . Here the second cycle tells which choice we made. It gives 2 u C b 2uC_b 2 u C b in the first case and u C 2 b uC_{2b} u C 2 b in the second. Thus a target can offer a separate choice for each of several weights u u u , then prescribe the sum of the weights selected.
Theorem 7.1. Fix h ≥ 1 h\geq1 h ≥ 1 and a prime q ∤ h q\nmid h q ∤ h . For binary cycle lists, counting quotient isomorphism classes is #P-complete under parsimonious polynomial-time reductions, even for divisors C h q + C h b C_{hq}+C_{hb} C h q + C hb with b > 1 b>1 b > 1 and gcd ( q , b ) = 1 \gcd(q,b)=1 g cd( q , b ) = 1 . The corresponding decision problem is NP-complete. In particular, h = 1 h=1 h = 1 and q = 2 q=2 q = 2 suffice.
We first identify every quotient of a target whose weights are given, then choose weights that encode exact covers.
Proof. Reading a subset from a quotient. Let u 1 , … , u s u_1,\ldots,u_s u 1 , … , u s be distinct positive proper divisors of b b b , where q ∣ b q\mid b q ∣ b . Write U = ∑ i = 1 s u i U=\sum_{i=1}^{s}u_i U = ∑ i = 1 s u i , fix 0 ≤ S ≤ U 0\leq S\leq U 0 ≤ S ≤ U , and set
A = C q + C b , B = ∑ i = 1 s q C q u i + q S C b + ( U − S ) C q b . A=C_q+C_b,\qquad B=\sum_{i=1}^{s}qC_{qu_i}+qSC_b+(U-S)C_{qb}. A = C q + C b , B = i = 1 ∑ s q C q u i + q S C b + ( U − S ) C q b .
Assume each prime dividing h h h divides every u i u_i u i . Write S h S_h S h for multiplication of cycle lengths by h h h , preserving their multiplicities. Our output is A ′ = S h ( A ) A' = S_h(A) A ′ = S h ( A ) and B ′ = h S h ( B ) B' = hS_h(B) B ′ = h S h ( B ) . The outer h h h multiplies the target multiplicities. For the C 2 + C b C_2 + C_b C 2 + C b case, read the row calculation below with h = 1 h = 1 h = 1 and q = 2 q = 2 q = 2 . For larger h h h , the issue is whether scaling introduces any additional quotient lengths.
Suppose A ′ Y = B ′ A'Y = B' A ′ Y = B ′ . Call the h q hq h q target cycles of length h q u i hqu_i h q u i row i i i . All come from C h q C_{hq} C h q , since h b ∣ h q u i hb \mid hqu_i hb ∣ h q u i would imply b ∣ u i b \mid u_i b ∣ u i . A quotient length y y y contributing to row i i i therefore satisfies lcm ( h q , y ) = h q u i \operatorname{lcm}(hq,y) = hqu_i lcm ( h q , y ) = h q u i . For each prime p ∣ h p \mid h p ∣ h , the exponent of p p p in h q u i hqu_i h q u i exceeds its exponent in h q hq h q . Thus y y y supplies the full exponent, and h ∣ y h \mid y h ∣ y . Writing y = h t y = ht y = h t leaves lcm ( q , t ) = q u i \operatorname{lcm}(q,t) = qu_i lcm ( q , t ) = q u i . Since q q q is prime and q ∤ u i q \nmid u_i q ∤ u i , only t = u i , q u i t = u_i, qu_i t = u i , q u i work. Their contributions to the row are h h h and h q hq h q cycles per copy. Writing z d z_d z d for the multiplicity of C d C_d C d in Y Y Y , the row equation becomes z h u i + q z h q u i = q z_{hu_i} + qz_{hqu_i} = q z h u i + q z h q u i = q . Its two nonnegative integer solutions give the alternatives
q C h u i (select i ) , C h q u i (omit i ) . qC_{hu_i}\quad\text{(select }i\text{)},\qquad C_{hqu_i}\quad\text{(omit }i\text{)}. q C h u i (select i ) , C h q u i (omit i ) .
The two choices use the same h q u i hqu_i h q u i states. A quotient cycle can supply only one row because its product with C h q C_{hq} C h q has a single length. Together the rows use h q U hqU h q U states. Since ∣ B ∣ = q ( q + b ) U |B| = q(q+b)U ∣ B ∣ = q ( q + b ) U , ∣ B ′ ∣ = h 2 ∣ B ∣ |B'| = h^2|B| ∣ B ′ ∣ = h 2 ∣ B ∣ , and ∣ A ′ ∣ = h ( q + b ) |A'| = h(q+b) ∣ A ′ ∣ = h ( q + b ) , the rows exhaust ∣ B ′ ∣ / ∣ A ′ ∣ |B'|/|A'| ∣ B ′ ∣/∣ A ′ ∣ . This excludes even a quotient cycle whose two products would both miss the rows. The length h q b hqb h q b is divisible by both divisor lengths, so Lemma 3.1 alone would not separate it. The exhaustion of the quotient states is what settles this shared length.
The second divisor cycle C h b C_{hb} C hb receives the choices from all rows. Each selected row contributes h q u i hqu_i h q u i copies of C h b C_{hb} C hb and each omitted row contributes h u i hu_i h u i copies of C h q b C_{hqb} C h q b . Thus the selected indices I I I give the prescribed target exactly when ∑ i ∈ I u i = S \sum_{i\in I}u_i = S ∑ i ∈ I u i = S . The bijection and its inverse are
Y I = ∑ i ∈ I q C h u i + ∑ i ∉ I C h q u i , I ( Y ) = { i : z h u i = q } . Y_I=\sum_{i\in I}qC_{hu_i}+\sum_{i\notin I}C_{hqu_i},\qquad I(Y)=\{i:z_{hu_i}=q\}. Y I = i ∈ I ∑ q C h u i + i ∈ / I ∑ C h q u i , I ( Y ) = { i : z h u i = q } .
Indeed, the u i u_i u i are distinct and none is divisible by q q q , so the 2 s 2s 2 s lengths h u i hu_i h u i , h q u i hqu_i h q u i are pairwise distinct. The formula specifies a cycle type, hence a single isomorphism class even when it uses q q q copies of one cycle. It works for every fixed h h h .
Making the selected weights form an exact cover. Our input consists of s s s distinct triples E i E_i E i drawn from { 0 , … , 3 k − 1 } \{0,\ldots,3k-1\} { 0 , … , 3 k − 1 } . The triples may overlap. Counting exact covers by triples is #P-complete under parsimonious reductions [17 Theorem 3.8 and Corollary 3.11] . For an empty ground set return A 0 = B 0 = C h q + C h ( q + 1 ) A_0 = B_0 = C_{hq} + C_{h(q+1)} A 0 = B 0 = C h q + C h ( q + 1 ) , with unique quotient C 1 C_1 C 1 . If s < k s < k s < k , return A 0 , C 1 A_0, C_1 A 0 , C 1 , with no quotient. We can now assume 1 ≤ k ≤ s 1 \le k \le s 1 ≤ k ≤ s before forming any powers. In his reduction from exact cover to knapsack, Karp uses base s + 1 s+1 s + 1 for s s s sets and one digit per element [19 p. 100] . Summing any subset of the weights counts incidences without carries, so the solutions of his 0 0 0 –1 1 1 equation are precisely the exact covers. For the two cycles we also need weights coprime to q q q . The extra unit below makes each weight one modulo q q q and records the number of chosen triples. Let Q = s + 2 Q = s+2 Q = s + 2 and M = q Q M = qQ M = q Q , and put
v i = 1 + M ∑ j ∈ E i Q j , T = k + M ∑ j = 0 3 k − 1 Q j . v_i=1+M\sum_{j\in E_i}Q^j,\qquad T=k+M\sum_{j=0}^{3k-1}Q^j. v i = 1 + M j ∈ E i ∑ Q j , T = k + M j = 0 ∑ 3 k − 1 Q j .
In ∑ i ∈ I v i = T \sum_{i\in I}v_i=T ∑ i ∈ I v i = T , reduction modulo M M M forces ∣ I ∣ = k |I|=k ∣ I ∣ = k , since both integers lie between 0 0 0 and s < M s<M s < M . After subtracting k k k and dividing by M M M , the j j j th base-Q Q Q digit on the left counts the selected triples containing j j j . There are no carries because s < Q s<Q s < Q . Each target digit is one, so precisely the exact covers satisfy this equation.
Take u i = h v i u_i=hv_i u i = h v i , S = h T S=hT S = h T , and b = ( q + 1 ) ∏ i u i b=(q+1)\prod_i u_i b = ( q + 1 ) ∏ i u i . Distinct triples give distinct weights. Each u i u_i u i divides b b b properly and q ∤ b q\nmid b q ∤ b , since q ∤ h q\nmid h q ∤ h and v i ≡ 1 ( m o d q ) v_i\equiv1\pmod q v i ≡ 1 ( mod q ) . If S > U S>U S > U , return the same zero-solution instance as above. Otherwise the row construction gives exactly one quotient per exact cover. Each weight uses O ( 1 + log ( h q ) + k log ( s + 2 ) ) O(1+\log(hq)+k\log(s+2)) O ( 1 + log ( h q ) + k log ( s + 2 )) bits, and the bit length of the product defining b b b is at most the sum of the bit lengths of its factors. Hence all lengths and multiplicities are produced in polynomial bit time. The same construction reduces the decision version of exact cover to division. Lemma B.1 gives membership in NP.
Counting every quotient once. For any two divisor lengths a 1 , a 2 a_1,a_2 a 1 , a 2 of gcd h h h , a quotient length d d d produces two observed target lengths r , c r,c r , c . Comparing prime exponents gives
g = gcd ( r , c ) = gcd ( lcm ( a 1 , d ) , lcm ( a 2 , d ) ) = lcm ( h , d ) , g / d = h / gcd ( h , d ) . g=\gcd(r,c)=\gcd(\operatorname{lcm}(a_1,d),\operatorname{lcm}(a_2,d))=\operatorname{lcm}(h,d),\qquad g/d=h/\gcd(h,d). g = g cd( r , c ) = g cd( lcm ( a 1 , d ) , lcm ( a 2 , d )) = lcm ( h , d ) , g / d = h / g cd( h , d ) .
Thus for each pair of target lengths, allowing repetition, we need only test g / e g/e g / e for divisors e e e of both h h h and g g g . With m m m distinct target lengths this gives at most m 2 τ ( h ) m^2\tau(h) m 2 τ ( h ) candidates. Sort the list and remove duplicates. If β \beta β is the largest target multiplicity, a quotient length can occur at most β \beta β times, as each copy contributes at least one cycle at a given output length. Guess exactly ⌈ log 2 ( 1 + β ) ⌉ \lceil\log_2(1+\beta)\rceil ⌈ log 2 ( 1 + β )⌉ bits for each multiplicity, reject values above β \beta β , and check the whole product by the cycle rule. Since h h h is fixed, these steps take polynomial bit time. There is one accepting path for each quotient class, proving membership in #P.
The divisibility condition on the weights prevents extra quotients under scaling. For example, ( C 3 + C 4 ) X = 3 ( C 3 + C 4 ) (C_3+C_4)X=3(C_3+C_4) ( C 3 + C 4 ) X = 3 ( C 3 + C 4 ) has just the quotient 3 C 1 3C_1 3 C 1 . With h = 2 h=2 h = 2 and u 1 = 1 u_1=1 u 1 = 1 , the scaled equation is ( C 6 + C 8 ) Y = 6 ( C 6 + C 8 ) (C_6+C_8)Y=6(C_6+C_8) ( C 6 + C 8 ) Y = 6 ( C 6 + C 8 ) . Any partition of six states into cycles of lengths one and two works, giving four quotient classes.
The colouring construction of § 4 also gives an exact count. A proper labelled edge-colouring in layer zero has two extensions on each connected component. In layer one the three colours at each vertex must undergo a fixed-point-free permutation, a shift by + 1 +1 + 1 or − 1 -1 − 1 modulo three. Neighbours must choose the same sign, and layer two then takes the remaining colour on each edge. Thus a graph G G G gives 2 cc ( G ) Col 3 ( G ) 2^{\operatorname{cc}(G)}\operatorname{Col}_3(G) 2 cc ( G ) Col 3 ( G ) quotient classes, where Col 3 ( G ) \operatorname{Col}_3(G) Col 3 ( G ) counts its proper labelled three-edge-colourings. For K 4 K_4 K 4 the six colourings give twelve classes. Appendix § 11 preserves these classes for other fixed gcds using S h ( B ) S_h(B) S h ( B ) as target and leaving the quotient itself unchanged. Its proof uses the special multiplicities of that construction.
The restriction on the gcd matters even for writing the answer. If it can grow with binary input length L L L , the number of bits in the quotient count can reach 2 Θ ( L / log L ) 2^{\Theta(L/\log L)} 2 Θ ( L / l o g L ) . Proposition C.2 gives a family attaining this bound and a matching upper bound for all binary cycle lists.
When is explicit division polynomial?
When one of the two lengths after division by their gcd has a bounded number of divisors, Theorem 2.2 already gives a polynomial algorithm for counting all quotient classes. Now allow both reduced divisor counts to grow and ask only for one quotient. Two size estimates determine exactly how fast SAT would have to be for this task to take polynomial time, as claimed in Theorem 1.1 (iii).
Proof. From a SAT algorithm to a division decision. Suppose SAT on m m m -bit inputs takes time m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) . Let N = ∣ A ∣ + ∣ B ∣ N=|A|+|B| N = ∣ A ∣ + ∣ B ∣ be the number of states in a division input. Lemma 2.1 gives each block a SAT encoding whose bit length ℓ \ell ℓ satisfies, for sufficiently large N N N and ℓ \ell ℓ ,
log ℓ = O ( log N / log log N ) , log log ℓ = O ( log log N ) . \log\ell=O(\log N/\log\log N),\qquad\log\log\ell=O(\log\log N). log ℓ = O ( log N / log log N ) , log log ℓ = O ( log log N ) .
Multiplying these estimates shows that the time per block is exp ( O ( log N ) ) = N O ( 1 ) \exp(O(\log N))=N^{O(1)} exp ( O ( log N )) = N O ( 1 ) . There are at most N N N blocks, and division is possible exactly when every block is feasible.
From a division decision to a SAT algorithm. Suppose we can decide D 2 D_2 D 2 in polynomial time. Convert an m m m -bit SAT instance in polynomial time to a simple cubic graph of size s = m O ( 1 ) s=m^{O(1)} s = m O ( 1 ) whose three-edge-colourability gives the answer [16 ] . Theorem D.1 writes the two successor tables in s O ( log log s ) s^{O(\log\log s)} s O ( l o g l o g s ) bit operations, so their total bit length is bounded by the same expression. Running the division algorithm takes at most a fixed power of this time. The resulting SAT algorithm runs in m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) time.
Recovering the cycles of one quotient. First ask whether A A A divides B B B . On a positive answer, try quotient cycles C t C_t C t in order of length, up to n = ∣ B ∣ / ∣ A ∣ n = |B|/|A| n = ∣ B ∣/∣ A ∣ . To try one copy, form P = A C t P = AC_t P = A C t . If the current target contains all cycles of P P P with their multiplicities, subtract them and ask whether the remainder is divisible by the same A A A . An empty remainder succeeds immediately. On success, record C t C_t C t , keep the remainder and try the same length again. On failure, keep the current target and advance to the next length.
The test succeeds exactly when some quotient of the current target contains C t C_t C t , since A ( C t + Y ) = P + A Y A(C_t + Y) = P + AY A ( C t + Y ) = P + A Y . Once a length fails, it cannot become possible later. Restoring the cycles already removed would produce a quotient containing it at the earlier stage. A feasible nonempty target always has some quotient cycle, so the process ends with a complete quotient. In fact n n n decision calls suffice on a positive instance. If the output has r r r cycles and its last cycle has length t t t , at most t − 1 t - 1 t − 1 lengths incur a failed oracle call. Only r − 1 r - 1 r − 1 successful removals use the oracle, since the last leaves an empty target. Including the initial test gives at most t + r − 1 ≤ n t + r - 1 \le n t + r − 1 ≤ n calls. Each query keeps the same divisor and has at most the original number of states. This argument applies to any explicit permutation divisor A A A .
Whether SAT meets the bound in part (iii) is open. Two October 2026 preprints report deterministic algorithms for 3-SAT with subexponential running time in the number of variables [7 , 25 ] . Even on 3-SAT, the stated bounds do not yield m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) time in the input bit length m m m . Parts (i) and (iii) both consider reductions from SAT to division. The construction used here has m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) time to write its tables. If a polynomial-time SAT algorithm could use a division oracle, part (i) would already give P = NP. In particular, if SAT misses the stated time bound, then P ≠ \ne = NP, part (i) rules out NP-hardness, and part (iii) rules out membership in P. If SAT meets the bound, D 2 D_2 D 2 belongs to P. This proves the claimed characterisation of when D 2 D_2 D 2 is NP-intermediate.
For each fixed pair a a a , b b b , Theorem 2.2 already gives a polynomial-time algorithm. What would it take for one polynomial time bound to work as both lengths vary?
Corollary 8.1 (Division by cycles of consecutive lengths). Fix h ≥ 1 h \ge1 h ≥ 1 and let d ≥ 2 d \ge2 d ≥ 2 vary. Suppose the divisor is C h d + C h ( d + 1 ) C_{hd} + C_{h(d+1)} C h d + C h ( d + 1 ) and the target is a nonempty permutation.
(i) With successor tables, a deterministic polynomial-time division test exists if and only if SAT on m m m -bit formulas can be decided in deterministic time m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) . Such a division test suffices to construct one quotient in polynomial time.
(ii) With successor tables, the exact quotient count is computable in deterministic polynomial time if and only if the satisfying assignments of an m m m -bit formula can be counted in deterministic time m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) .
(iii) With binary cycle lists, counting quotient isomorphism classes is #P-complete under parsimonious polynomial-time reductions, and deciding division is NP-complete.
The two explicit equivalences also hold for arbitrary pairs of lengths and for the family in which neither length divides the other, with either a prescribed or an unrestricted greatest common divisor.
Proof. Changing the gcd on the instances of the graph construction. Theorem A handles any input at its own gcd. For the hard direction here the starting graph gives coprime lengths, while the output gcd h h h may be prescribed in advance. The separated table of Lemma 3.1 permits a direct construction with a smaller explicit size bound. Its row weights u i u_i u i divide b b b properly, its column weights v j v_j v j divide a a a properly, and its required multiplicities are R i , S j R_i, S_j R i , S j .
To prescribe the gcd, write h = α β h = \alpha\beta h = α β , placing in β \beta β the full powers of the primes of h h h that divide b b b . Then U = α a U = \alpha a U = α a and V = β b V = \beta b V = β b are coprime and exceed one. Take P P P to be the inverse of U U U modulo V V V in { 1 , … , V − 1 } \{1,\ldots,V-1\} { 1 , … , V − 1 } and put Q = ( U P − 1 ) / V Q=(UP-1)/V Q = ( U P − 1 ) / V . We have 1 ≤ Q < U 1\le Q<U 1 ≤ Q < U and U P = V Q + 1 UP=VQ+1 U P = V Q + 1 , so the new bases P a , Q b P^a,Q^b P a , Q b are coprime. With R i , S j R_i,S_j R i , S j the original margins, output
A ′ = C h U P + C h V Q , B ′ = ∑ i h a R i C h 2 P a i u + ∑ j h b S j C h 2 Q b j v . A'=C_{hUP}+C_{hVQ},\qquad B'=\sum_i haR_iC_{h^2Pa^u_i}+\sum_j hbS_jC_{h^2Qb^v_j}. A ′ = C h U P + C hV Q , B ′ = i ∑ ha R i C h 2 P a i u + j ∑ hb S j C h 2 Q b j v .
Here d = V Q ≥ 2 d=VQ\ge2 d = V Q ≥ 2 . We show that multiplying every old quotient length by h 2 h^2 h 2 gives a bijection on solutions.
Take a cycle of length y y y in any new quotient and let r , c r,c r , c be its two product lengths. Comparing prime exponents gives
gcd ( r , c ) = gcd ( lcm ( h U P , y ) , lcm ( h V Q , y ) ) = lcm ( h , y ) . \gcd(r,c)=\gcd(\operatorname{lcm}(hUP,y),\operatorname{lcm}(hVQ,y))=\operatorname{lcm}(h,y). g cd( r , c ) = g cd( lcm ( h U P , y ) , lcm ( hV Q , y )) = lcm ( h , y ) .
Every cycle length in B ′ B' B ′ is a multiple of h 2 h^2 h 2 , so h 2 h^2 h 2 divides both r r r and c c c . For each p e ∥ h p^e\parallel h p e ∥ h , e ≥ 1 e\ge1 e ≥ 1 , we therefore have max ( e , ν p ( y ) ) ≥ 2 e \max(e,\nu_p(y))\ge2e max ( e , ν p ( y )) ≥ 2 e , which forces p 2 e ∣ y p^{2e}\mid y p 2 e ∣ y . Thus y = h 2 t y=h^2t y = h 2 t and y = gcd ( r , c ) y=\gcd(r,c) y = g cd( r , c ) . Now r = h 2 lcm ( P a , t ) r=h^2\operatorname{lcm}(P^a,t) r = h 2 lcm ( P a , t ) and c = h 2 lcm ( Q b , t ) c=h^2\operatorname{lcm}(Q^b,t) c = h 2 lcm ( Q b , t ) , because gcd ( P a , β ) = gcd ( Q b , α ) = 1 \gcd(P^a,\beta)=\gcd(Q^b,\alpha)=1 g cd( P a , β ) = g cd( Q b , α ) = 1 . The first length can hit only a row, since P a ∤ Q b v j P^a\nmid Q^bv_j P a ∤ Q b v j , and the second only a column, since Q b ∤ P a u i Q^b\nmid P^au_i Q b ∤ P a u i . Their gcd recovers y = h 2 u i v j y=h^2u_iv_j y = h 2 u i v j . One such cycle contributes h a v j ha v_j ha v j copies to its row and h b u i hb u_i hb u i copies to its column. Cancelling the corresponding factor in each margin gives exactly the old table equations, also showing that every old table gives a solution.
The extended Euclidean algorithm finds P , Q P,Q P , Q in polynomial bit time. If the input tables have N N N states together, each row’s contribution to the target size grows by h 3 α P ≤ h 4 N h^3\alpha P\le h^4N h 3 α P ≤ h 4 N , and each column’s by h 3 β Q ≤ h 4 N h^3\beta Q\le h^4N h 3 β Q ≤ h 4 N . The divisor lengths grow by at most h 2 N h^2N h 2 N . Hence the output has at most h 4 N 2 h^4N^2 h 4 N 2 states, including on negative inputs. For fixed h h h both successor tables can be written in polynomial bit time. In binary lists the construction uses integers of polynomial bit length throughout.
Explicit decision and counting. For decision, apply the two implications proved above for Theorem 1.1 (iii). Lemma 2.1 applies to every pair of divisor lengths. In the reverse direction, Theorem D.1 produces a weighted-table instance of Lemma 3.1 . It is enough to change the divisor lengths on the instances produced by this reduction. Making them consecutive incurs polynomial overhead in the written tables and preserves every quotient class under the stated bijection. The construction of a witness keeps the divisor unchanged in every query.
For counting, encode each block of Lemma 2.1 by a Boolean circuit. Give each multiplicity a fixed number of bits, impose its upper bound, and check the equations. In the SAT encoding require the output to be true and impose an equivalence at every gate. Each feasible vector then has exactly one satisfying extension to the gate variables. The encoding is polynomial in the short block length, so a counting-SAT algorithm with the stated time bound takes N O ( 1 ) N^{O(1)} N O ( 1 ) time per block. Multiply the counts of the independent blocks. These products have O ( N log ( 2 N ) ) O(N\log(2N)) O ( N log ( 2 N )) bits because there are at most N N N variables with at most N + 1 N+1 N + 1 choices each.
For the converse, Cai and Govorov prove #P-completeness for counting labelled three-edge-colourings of simple cubic graphs under polynomial-time Turing reductions [6 Theorem 1.1] . The empty graph has one colouring. For a nonempty queried graph G G G , suppose the routing in § 6 inserts k k k diamonds. The two exterior edges of each diamond must have the same colour. Restore the missing edge of K 4 K_4 K 4 in that colour. Its opposite edge is then forced, and the remaining four edges form a cycle admitting exactly two alternating colourings. The routed graph therefore has 2 k Col 3 ( G ) 2^k\operatorname{Col}_3(G) 2 k Col 3 ( G ) labelled colourings and the same number of components as G G G . By § 7 its table has exactly 2 k + cc ( G ) Col 3 ( G ) 2^{k+\operatorname{cc}(G)}\operatorname{Col}_3(G) 2 k + cc ( G ) Col 3 ( G ) quotient classes. The consecutive construction preserves that number. Exact division by the known power of two recovers Col 3 ( G ) \operatorname{Col}_3(G) Col 3 ( G ) , including when it is zero. On an m m m -bit counting-SAT input, the Turing reduction asks polynomially many questions about graphs of polynomial size. For each question, writing the successor tables by Theorem D.1 , making the lengths consecutive and running a polynomial-time quotient counter together take m O ( log log m ) m^{O(\log\log m)} m O ( l o g l o g m ) bit operations.
Binary counting. Theorem 7.1 supplies, for each prescribed h h h , a parsimonious reduction to binary division with divisor gcd h \gcd h g cdh . Theorem A transforms each resulting instance in polynomial bit time, keeps that gcd and preserves every quotient class. The same fixed-gcd counting algorithm as in Theorem 7.1 proves membership in # P \#\mathrm{P} # P . Existence gives the corresponding NP-complete decision problem.
A fixed number of distinct divisor lengths. For every fixed r ≥ 2 r \ge2 r ≥ 2 , the two explicit equivalences of Corollary 8.1 also hold for divisors with at most r r r distinct lengths and arbitrary multiplicities. Indeed the lower directions already use two cycles. For the upper directions D ≤ N r D \le N^r D ≤ N r , so the extension of Lemma 2.1 in § 2 applies, with one bounded variable per quotient length. Its gate encoding again preserves the count. The witness construction in this section keeps the divisor fixed.
What changes if the target has transient states?
Attach one leaf to each vertex of C 2 + C 3 C_2 + C_3 C 2 + C 3 . This ten-state target is divisible by C 2 + C 3 C_2 + C_3 C 2 + C 3 : the quotient is a fixed point with one leaf. Now move the two leaves of the 2-cycle onto the same vertex. A quotient would still have 10 / 5 = 2 10/5 = 2 10/5 = 2 states. It must have a transient state, since the target does. The only such two-state system is a fixed point with one leaf, and its product puts one leaf at every cycle vertex. The position of the leaves therefore rules out a quotient.
Bridoux et al. already suggest using repeated tree patterns to decide division by a fixed permutation for targets with transient states [5 Section 6] . Porreca and Rolland construct one quotient in polynomial time when the shortest divisor length divides all the others [26 Theorem 61] . Here both divisor lengths may vary and be incomparable. We use the patterns to carry the count, the witness and the change of lengths over to these targets.
Corollary 8.2. Let A = C a + C b A = C_a + C_b A = C a + C b and let B B B be any nonempty finite dynamical system given by a successor table. The consecutive normal form of Theorem A still preserves all quotient classes, with O ( N 4 ) O(N^4) O ( N 4 ) output states. The counting and witness algorithm of Theorem 2.2 retains its ( N + 1 ) K + O ( 1 ) (N + 1)^{K+O(1)} ( N + 1 ) K + O ( 1 ) bit bound. The explicit decision and counting equivalences in Corollary 8.1 hold for these targets as well.
Proof. Delete the cycle edges of a connected component. At each cycle vertex a rooted tree remains, possibly just the root. Read the trees in successor order around the cycle. Their cyclic sequence is a repetition of a unique shortest word W W W , up to rotation. Choosing a different first vertex rotates the word. Once its image is chosen, the successor determines the images of the other cycle vertices. Thus W W W up to rotation and the cycle length t t t specify the component up to isomorphism. The admissible lengths are the multiples of e = ∣ W ∣ e = |W| e = ∣ W ∣ .
Multiplication by C a C_a C a gives gcd ( a , t ) \gcd(a,t) g cd( a , t ) components of length lcm ( a , t ) \operatorname{lcm}(a,t) lcm ( a , t ) , all with the same primitive word W W W . Indeed the first coordinate has a unique predecessor at every step, so following a tree backwards copies it unchanged. This is the repetition identity of Naquin and Gaudul eau [24 Lemma 13 and Corollary 14] , also stated by Porreca and Rolland [26 Lemma 13] . In particular, every word of a quotient occurs in the target. Compute tree types from the leaves upwards by sorting the types of the children. Comparing rotations and testing periods yields all the words in polynomial time.
For each observed W W W , keep only its target components and record their cycle lengths. Equation (1) now counts components of this word. Keep precisely the quotient variables with e ∣ t e \mid t e ∣ t . The equations for different words have disjoint variables, and each solution vector gives exactly one multiset of decorated components. Within a word, all state-balance calculations use periodic states. The short-query construction and the row dynamic program simply skip the excluded lengths. There are at most N N N words. Multiply their counts and assemble a witness by repeating each word around its chosen cycles. For the SAT-to-division implications, permutation targets already suffice. In the opposite direction, a satisfying assignment for each short block can be recovered by fixing its bits successively.
For the normal form, use the same P P P , Q Q Q for all words, and apply § 3.1 to each word’s periodic lengths. Keep the decoration W W W in each output component. Its new cycle length is a multiple of its old one, so this is always possible. Could a new quotient cycle of length y y y carry W W W while its original length t t t cannot? In the block of label R R R , write E = P R Q R E=P_RQ_R E = P R Q R . The proof of Theorem A gives t = y / E t=y/E t = y / E . This length divides R R R and contains the full prime power of R R R at each prime dividing E E E . Thus gcd ( E , R / t ) = 1 \gcd(E,R/t)=1 g cd( E , R / t ) = 1 and gcd ( y , R ) = t gcd ( E , R / t ) = t \gcd(y,R)=t\gcd(E,R/t)=t g cd( y , R ) = t g cd( E , R / t ) = t . The period e e e divides R R R because it divides an observed cycle length in this block. It follows that e ∣ y e\mid y e ∣ y if and only if e ∣ t e\mid t e ∣ t , even if e e e and E E E share a prime. The inverse therefore preserves admissible lengths.
Finally, let the trees in one copy of W W W have h h h states in total, including their roots. A component of cycle length r r r contains r / e r/e r / e copies of W W W , hence ( r / e ) h (r/e)h ( r / e ) h states. The proof of Theorem A bounds the growth in periodic target states for this word by a factor of P Q max ( P , Q ) PQ\max(P,Q) P Q max ( P , Q ) . Multiplying both state counts by h / e h/e h / e gives the same bound for all its states, however large a single tree may be. Summing over the words gives ∣ B ′ ∣ ≤ P Q max ( P , Q ) ∣ B ∣ |B'|\le PQ\max(P,Q)|B| ∣ B ′ ∣ ≤ P Q max ( P , Q ) ∣ B ∣ . Together with the new divisor this gives the claimed O ( N 4 ) O(N^4) O ( N 4 ) output size. □
Computational checks. The companion scripts and reference outputs test the block equations, diamond colourings and exact-cover construction. They compare quotient classes before and after the change to consecutive lengths, including cases where a row and a column share a length. For targets with trees, they test changes of the starting vertex and count the states after attaching a large tree to one cycle vertex. For Proposition C.3 , they compare the two-by-two table with exhaustive search and check the queries used to recover prime factors.
The arithmetic behind the explicit encoding
Proof of Lemma 6.2. Write u ( x ) = ∑ i ∈ x 2 i u(x)=\sum_{i\in x}2^i u ( x ) = ∑ i ∈ x 2 i , the integer encoded by the address. To see what must be distinguished, consider two different addresses. If their signed coefficients have both sum zero and first moment ∑ x b x u ( x ) = 0 \sum_x b_xu(x)=0 ∑ x b x u ( x ) = 0 , both coefficients vanish. For up to H H H addresses we will read the first H H H moments from a single congruence.
Choose a base P = M ( 1 + H C 2 d H ) P=M(1+HC2^{dH}) P = M ( 1 + H C 2 d H ) and a modulus K = P H K=P^H K = P H . Set q = 1 + 10 8 d K q=1+10^8dK q = 1 + 1 0 8 d K . For each i i i let δ i \delta_i δ i be the least nonnegative residue of ( 1 + P ) 2 i − 1 (1+P)^{2^i}-1 ( 1 + P ) 2 i − 1 modulo K K K , and put z i = q + δ i z_i=q+\delta_i z i = q + δ i . Multiplication of the factors for the bits gives
U ( x ) ≡ ( 1 + P ) u ( x ) ( m o d K ) . U(x)\equiv(1+P)^{u(x)}\pmod K. U ( x ) ≡ ( 1 + P ) u ( x ) ( mod K ) .
In particular all U ( x ) U(x) U ( x ) equal one modulo M M M . Since 0 ≤ δ i < K 0\le\delta_i<K 0 ≤ δ i < K , the ratio U ( x ) / q d U(x)/q^d U ( x ) / q d is at most ( 1 + 10 − 8 / d ) d < 1 + 10 − 7 (1+10^{-8}/d)^d<1+10^{-7} ( 1 + 1 0 − 8 / d ) d < 1 + 1 0 − 7 . The size of q q q gives the claimed logarithmic bound, and repeated squaring computes each residue.
In fact it suffices to have ∑ x b x U ( x ) ≡ 0 ( m o d K ) \sum_x b_xU(x)\equiv0\pmod K ∑ x b x U ( x ) ≡ 0 ( mod K ) . Expanding the displayed congruence in powers of P P P yields
∑ j = 0 H − 1 P j M j ≡ 0 ( m o d P H ) , M j = ∑ x b x ( u ( x ) j ) . \sum_{j=0}^{H-1}P^jM_j\equiv0\pmod{P^H},\qquad M_j=\sum_xb_x\binom{u(x)}{j}. j = 0 ∑ H − 1 P j M j ≡ 0 ( mod P H ) , M j = x ∑ b x ( j u ( x ) ) .
Each signed coefficient satisfies ∣ M j ∣ ≤ H C 2 d H < P |M_j|\le HC2^{dH}<P ∣ M j ∣ ≤ H C 2 d H < P . Reducing modulo P P P gives M 0 = 0 M_0=0 M 0 = 0 . Dividing by P P P and repeating gives all M j = 0 M_j=0 M j = 0 . If r ≤ H r\le H r ≤ H addresses have nonzero coefficients, the polynomials ( ⋅ j ) \binom{\,\cdot\,}{j} ( j ⋅ ) for 0 ≤ j < r 0\le j<r 0 ≤ j < r span the polynomials of degree less than r r r over Q \mathbb{Q} Q . At any one of the r r r distinct points u ( x ) u(x) u ( x ) we may therefore interpolate a polynomial that takes value one there and zero at the others. Its vanishing weighted sum gives b x = 0 b_x=0 b x = 0 at that point. □
Checking the individual names in Theorem 6.1 . In a relation of norm at most H H H , write γ α \gamma_\alpha γ α for the signed coefficient of name α \alpha α and μ α \mu_\alpha μ α for its full slot coefficient (ρ \rho ρ or ν \nu ν ). Collect the names at each address into a single coefficient b x b_x b x , so that
b x = ∑ α at x γ α μ α , ∑ x ∣ b x ∣ ≤ C ∑ α ∣ γ α ∣ ≤ C H . b_x = \sum_{\alpha\text{ at }x} \gamma_\alpha\mu_\alpha,\qquad\sum_x \lvert b_x\rvert\le C\sum_\alpha\lvert\gamma_\alpha\rvert\le CH. b x = α at x ∑ γ α μ α , x ∑ ∣ b x ∣ ≤ C α ∑ ∣ γ α ∣ ≤ C H .
At most H H H addresses contribute, so a relation ∑ x b x U ( x ) = 0 \sum_x b_xU(x)=0 ∑ x b x U ( x ) = 0 gives b x = 0 b_x=0 b x = 0 at each of them. Within one row address the scale W 0 W_0 W 0 separates the centre term from the slot sum of absolute value at most 30 ⋅ 1024 J r − 1 < W 0 30\cdot1024^{J_r-1}<W_0 30 ⋅ 102 4 J r − 1 < W 0 . For a column address, first reduce modulo R R R . The sum of the signed offsets has absolute value at most 60 < R 60<R 60 < R , so it vanishes. Divide by R R R and separate the centre in the same way using V 0 V_0 V 0 . On either axis the slot sum is now zero. Dividing by the smallest occupied power of 1024 1024 1024 and reducing modulo 1024 1024 1024 forces its coefficient to vanish, since its absolute value is at most 30 30 30 . Hence there was no nonzero short relation.
Write q c , q r q_c,q_r q c , q r for the values of q q q on the two axes. The scales are V = R V 0 q c d V=RV_0q_c^d V = R V 0 q c d and W = W 0 q r d W=W_0q_r^d W = W 0 q r d . Before multiplication by U ( x ) U(x) U ( x ) , each slot term is at most 1024 − 4 1024^{-4} 102 4 − 4 times R V 0 RV_0 R V 0 or W 0 W_0 W 0 on its axis. The column offset adds at most 2 / ( R V 0 ) 2/(RV_0) 2/ ( R V 0 ) to the relative error, and 1 ≤ U ( x ) / q d < 1 + 10 − 7 1\le U(x)/q^d<1+10^{-7} 1 ≤ U ( x ) / q d < 1 + 1 0 − 7 . This gives all the scale conditions of Lemma 4.1 , including 0 < D v < 10 − 5 V 0<D_v<10^{-5}V 0 < D v < 1 0 − 5 V . The difference of two distinct formal weights on either axis has norm at most 30 30 30 . Independence therefore makes the weights numerically distinct, as required.
Short witnesses for binary division
Constructing a quotient for one divisor length. With a single divisor length A = α C u A=\alpha C_u A = α C u , different target lengths can be treated separately. We give the single-length criterion of Dennunzio et al. [10 Theorems 3 and 4] in the notation of this paper. For β C ℓ \beta C_\ell β C ℓ first require u ∣ ℓ u\mid\ell u ∣ ℓ . Write r = ℓ / u r=\ell/u r = ℓ / u and g = gcd ( u , r ⌈ log 2 ( u + 1 ) ⌉ ) g=\gcd(u,r^{\lceil\log_2(u+1)\rceil}) g = g cd( u , r ⌈ l o g 2 ( u + 1 )⌉ ) . This extracts the full prime powers of u u u at the primes dividing r r r . If lcm ( u , t ) = ℓ \operatorname{lcm}(u,t)=\ell lcm ( u , t ) = ℓ , then g ∣ gcd ( u , t ) g\mid\gcd(u,t) g ∣ g cd( u , t ) , and t = r g t=rg t = r g attains equality and has the required lcm. Thus α g ∣ β \alpha g\mid\beta α g ∣ β is necessary and sufficient. Taking β / ( α g ) \beta/(\alpha g) β / ( α g ) copies of C r g C_{rg} C r g constructs that part of the quotient. A modular power and a gcd suffice, so this also gives a polynomial-time binary algorithm.
For two coprime divisor lengths, the list of candidate gcds in § 3 already bounds the number of multiplicities we need to guess. For a general divisor an economical certificate comes from choosing the solution with the fewest distinct lengths.
Lemma B.1 (A short binary witness). For any binary cycle lists A , B A,B A , B , a positive instance has a quotient with at most ∑ j log 2 ( 1 + β j ) \sum_j\log_2(1+\beta_j) ∑ j log 2 ( 1 + β j ) distinct cycle lengths, where β j \beta_j β j are the positive multiplicities in B B B . Binary division is in NP.
Proof. Choose a quotient with as few distinct lengths as possible. For each used length t t t let w ( t ) w(t) w ( t ) be the nonzero nonnegative vector of multiplicities in A C t AC_t A C t at the target lengths. Every subset sum of these vectors lies in the box ∏ j { 0 , … , β j } \prod_j\{0,\ldots,\beta_j\} ∏ j { 0 , … , β j } . If two distinct subsets have the same sum, cancel their intersection. Both remaining subsets are nonempty. Let k k k be the least multiplicity in the first subset. Subtract k k k from each multiplicity in that subset and add k k k to each multiplicity in the other. The product is unchanged and a used length disappears. This contradicts minimality. Comparing the number of subsets with the box size proves the bound, the target-box bound of Eisenbrand and Shmonin [13 Lemma 3] applied to these product columns. The same exchange bounds the number of distinct lengths needed in a minimum-size realisation of prescribed prime marginals [22 Lemma 4.1, pp. 8–9] . Each used length divides a target length, and each multiplicity is at most max j β j \max_j\beta_j max j β j . The resulting binary list has polynomial bit length and can be verified by the gcd/lcm product rule.
Proposition B.2 (One binary quotient from the reduced ratio). Let A = C a + C b A = C_a + C_b A = C a + C b and B B B be given by binary cycle lists of total bit length L L L . Put g = gcd ( a , b ) g = \gcd(a,b) g = g cd( a , b ) and k = τ ( a / g ) τ ( b / g ) k = \tau(a/g)\tau(b/g) k = τ ( a / g ) τ ( b / g ) . A deterministic algorithm constructs a binary quotient when one exists, and detects infeasibility otherwise, in f ( k ) L O ( 1 ) f(k)L^{O(1)} f ( k ) L O ( 1 ) bit operations for a computable function f f f .
Proof. Suppose a quotient cycle produces lengths u u u and v v v under the two projections. We need only one representative length for this ordered pair. To find it, let m a ( u ) m_a(u) m a ( u ) be the least t t t with lcm ( a , t ) = u \operatorname{lcm}(a,t) = u lcm ( a , t ) = u , defined when a ∣ u a \mid u a ∣ u . The single-length calculation above gives m a ( u ) = r gcd ( a , r ⌈ log 2 ( a + 1 ) ⌉ ) m_a(u) = r\gcd(a,r^{\lceil\log_2(a+1)\rceil}) m a ( u ) = r g cd( a , r ⌈ l o g 2 ( a + 1 )⌉ ) with r = u / a r = u/a r = u / a . Every admissible t t t is a multiple of m a ( u ) m_a(u) m a ( u ) because for each prime whose exponent in u u u exceeds its exponent in a a a , the full power in u u u must come from t t t . These are exactly the prime powers in m a ( u ) m_a(u) m a ( u ) . This least-length computation also appears in Porreca and Rolland [26 Theorems 20–23] .
Try every ordered pair of observed lengths, including u = v u = v u = v , with a ∣ u a \mid u a ∣ u , b ∣ v b \mid v b ∣ v . Form s = lcm ( m a ( u ) , m b ( v ) ) s = \operatorname{lcm}(m_a(u),m_b(v)) s = lcm ( m a ( u ) , m b ( v )) and keep it if lcm ( a , s ) = u \operatorname{lcm}(a,s) = u lcm ( a , s ) = u and lcm ( b , s ) = v \operatorname{lcm}(b,s) = v lcm ( b , s ) = v . If any t t t realises the pair, then s ∣ t s \mid t s ∣ t . Also m a ( u ) ∣ s ∣ t m_a(u) \mid s \mid t m a ( u ) ∣ s ∣ t , so u ∣ lcm ( a , s ) ∣ u u \mid\operatorname{lcm}(a,s) \mid u u ∣ lcm ( a , s ) ∣ u , and similarly for v v v . Now gcd ( a , t ) = a t / u = ( t / s ) gcd ( a , s ) \gcd(a,t) = at/u = (t/s)\gcd(a,s) g cd( a , t ) = a t / u = ( t / s ) g cd( a , s ) , with the analogous identity for b b b . Thus one C t C_t C t can always be replaced by t / s t/s t / s copies of C s C_s C s without changing either projection. Porreca and Rolland use a related replacement for pseudo-cancelable divisors [26 proof of Lemma 28] . Fixing the ordered output pair here gives the same multiplicity ratio t / s t/s t / s in both projections for arbitrary a , b a,b a , b . Different quotients may therefore have the same representative. For A = C 4 + C 6 A = C_4 + C_6 A = C 4 + C 6 , both C 2 C_2 C 2 and 2 C 1 2C_1 2 C 1 give the target 2 A 2A 2 A .
Build the multiplicity equations only for the retained lengths, adding both contributions when u = v u = v u = v and including every target equation. There are at most quadratically many candidate pairs in the binary list. The gcds and lcms take polynomial time in the binary input length. Each coefficient is at most a + b a+b a + b , even when both contributions go to the same equation. Write D = lcm ( a , b ) D = \operatorname{lcm}(a,b) D = lcm ( a , b ) and group the equations as in Lemma 2.1, by R = lcm ( D , s ) R = \operatorname{lcm}(D,s) R = lcm ( D , s ) . For fixed R R R the row and column bounds in the proof of Theorem 2.2 give at most τ ( b / g ) \tau(b/g) τ ( b / g ) possible first lengths and τ ( a / g ) \tau(a/g) τ ( a / g ) possible second lengths. We kept only one representative per ordered pair, so the block has at most k k k variables. Grouping the observed pairs requires no factorisation of a a a or b b b . This is integer programming in fixed dimension [23 ] . Kannan’s bound separates the dependence on the dimension from the polynomial in the binary input length [18 Theorem 5.4] . Since each block has dimension at most k k k and the entire list of blocks has polynomial encoding length, they take f ( k ) L O ( 1 ) f(k)L^{O(1)} f ( k ) L O ( 1 ) bit operations in total. If only a feasibility oracle is used, recover each multiplicity by binary search between zero and the largest target multiplicity, fixing coordinates as they are recovered. Their union gives the required binary quotient.
Fixed and growing common divisors
Theorem C.1. For every fixed h ≥ 1 h \ge1 h ≥ 1 , division of binary cycle lists is NP-complete for divisors C h a + C h b C_{ha} + C_{hb} C ha + C hb with a , b ≥ 1 a,b \ge1 a , b ≥ 1 and gcd ( a , b ) = 1 \gcd(a,b) = 1 g cd( a , b ) = 1 . In the reduction the quotient classes are in bijection with the tables of Lemma 4.1.
Proof. The case h = 1 h = 1 h = 1 is Theorem 5.1. For h > 1 h > 1 h > 1 we will multiply each divisor and target length by h h h . Two properties of the original instance will preserve its quotients. Coprimality of each quotient length with h h h lets us carry a quotient forward. Multiplicity one will let us reverse the construction. A cycle whose length shares a factor with h h h splits into repeated cycles under the h h h th iterate.
Replace each row identifier c W 0 + Q j cW_0 + Q^j c W 0 + Q j of (5) by c ( h W 0 + 1 ) + h Q j c(hW_0 + 1) + hQ^j c ( h W 0 + 1 ) + h Q j . The resulting identifiers have residues 1 , 1 , 1 , 3 1,1,1,3 1 , 1 , 1 , 3 modulo h h h for the four kinds of names p , g , r , T p,g,r,T p , g , r , T . All row weights, including p + g − r p+g-r p + g − r and T − p − g T-p-g T − p − g , are therefore 1 1 1 modulo h h h . Their least common multiple b b b is coprime to h h h . In (6) use the multiplier h b hb hb in place of b b b , keeping the respective offsets 1 , 2 , 0 1,2,0 1 , 2 , 0 on B , H , D B,H,D B , H , D . Every column weight is then 1 1 1 modulo h b hb hb , so its axis lcm a \operatorname{lcm} a lcm a is coprime to both b b b and h h h . The digit proof still works. On rows the low part of any tested relation has absolute value less than h W 0 + 1 hW_0+1 h W 0 + 1 . On columns the sum of the offsets in a tested relation has absolute value at most 60 < h b 60<hb 60 < hb . Removing the centre or the offsets, respectively, leaves the same independent digits as before. The relative error windows continue to hold about the new scales h W 0 + 1 hW_0+1 h W 0 + 1 and h b V 0 hbV_0 hb V 0 . The bit lengths remain polynomial for fixed h h h .
Let A = C a + C b A=C_a+C_b A = C a + C b and B B B be the target constructed with these identifiers. By Lemma 3.1 , the quotient lengths are among the distinct products u i v j u_i v_j u i v j , all coprime to h h h . By Lemma 4.1 , each column of a feasible table uses three distinct rows. Thus its cells are 0 or 1, giving the second property as well.
Write S h ( Z ) S_h(Z) S h ( Z ) for the result of multiplying each length in Z Z Z by h h h , and I h ( Z ) I_h(Z) I h ( Z ) for the permutation obtained by taking the h h h th iterate. For example, S 2 ( C 3 ) = C 6 S_2(C_3)=C_6 S 2 ( C 3 ) = C 6 and I 2 ( C 6 ) = 2 C 3 I_2(C_6)=2C_3 I 2 ( C 6 ) = 2 C 3 . Output S h ( A ) , S h ( B ) S_h(A),S_h(B) S h ( A ) , S h ( B ) . If A X = B AX=B A X = B , each length d d d in X X X is coprime to h h h , so C h a C d = S h ( C a C d ) C_{ha}C_d=S_h(C_aC_d) C ha C d = S h ( C a C d ) and likewise for b b b . Thus the same X X X solves the new equation. Conversely suppose S h ( A ) Y = S h ( B ) S_h(A)Y=S_h(B) S h ( A ) Y = S h ( B ) . Iteration commutes with products, and I h ( S h ( Z ) ) = h Z I_h(S_h(Z))=hZ I h ( S h ( Z )) = h Z . Applying I h I_h I h and cancelling the common multiplicity h h h gives A I h ( Y ) = B AI_h(Y)=B A I h ( Y ) = B . Each C t C_t C t of Y Y Y contributes gcd ( h , t ) \gcd(h,t) g cd( h , t ) copies of C t / gcd ( h , t ) C_{t/\gcd(h,t)} C t / g c d ( h , t ) to I h ( Y ) I_h(Y) I h ( Y ) . Every length in this quotient occurs just once, so gcd ( h , t ) = 1 \gcd(h,t)=1 g cd( h , t ) = 1 for every such t t t . Hence Y ≅ I h ( Y ) Y\cong I_h(Y) Y ≅ I h ( Y ) and Y Y Y already solves the original equation. We have preserved the entire set of quotient classes. NP membership follows from Lemma B.1.
Proposition C.2. Among binary cycle-list inputs of length at most L L L , the maximum number of bits needed to write the quotient count is 2 Θ ( L / log L ) 2^{\Theta(L/\log L)} 2 Θ ( L / l o g L ) . The lower bound is attained by divisors A = C 2 g + C 3 g A=C_{2g}+C_{3g} A = C 2 g + C 3 g . For the same divisor family Proposition B.2 constructs a binary quotient in polynomial bit time for every target that admits one, since each block has at most four representative variables. With successor tables, Theorem 2.2 also gives polynomial-time exact counting on the entire family.
Proof. Every quotient length divides a target length, and every target length b b b satisfies b ≤ 2 L b\le2^L b ≤ 2 L . To bound τ ( b ) \tau(b) τ ( b ) , write b = ∏ p e p b=\prod p^{e_p} b = ∏ p e p . Primes p ≤ L p\le\sqrt{L} p ≤ L contribute at most L log 2 ( L + 1 ) \sqrt{L}\log_2(L+1) L log 2 ( L + 1 ) to log 2 τ ( b ) = ∑ p ∣ b log 2 ( e p + 1 ) \log_2\tau(b)=\sum_{p\mid b}\log_2(e_p+1) log 2 τ ( b ) = ∑ p ∣ b log 2 ( e p + 1 ) . For larger primes, ∑ e p ≤ 2 L / log 2 L \sum e_p\le2L/\log_2 L ∑ e p ≤ 2 L / log 2 L and log 2 ( e p + 1 ) ≤ e p \log_2(e_p+1)\le e_p log 2 ( e p + 1 ) ≤ e p . Thus even the union of the divisor sets of all target lengths has size 2 O ( L / log L ) 2^{O(L/\log L)} 2 O ( L / l o g L ) . Each quotient multiplicity has at most 1 + 2 L 1+2^L 1 + 2 L possible values. Taking the logarithm of the product of these bounds gives the claimed upper bound on the number of answer bits.
The lower bound already occurs in a one-cycle example of Bridoux et al. [5 Appendix B, Lemmas 13–14] , using the divisor-partition estimate of Erdős and Oldyzhko [4 ] . For a primordial n n n , their count for C n X = n C n C_nX=nC_n C n X = n C n needs at least 2 Ω ( log n / log log n ) 2^{\Omega(\log n/\log\log n)} 2 Ω ( l o g n / l o g l o g n ) bits. The two-cycle divisor A = C 2 n + C 3 n A=C_{2n}+C_{3n} A = C 2 n + C 3 n preserves the entire set. Indeed, in A X = n A AX=nA A X = n A the C 2 n C_{2n} C 2 n projection can only produce length 2 n 2n 2 n , and the C 3 n C_{3n} C 3 n projection can only produce length 3 n 3n 3 n . Every quotient length must therefore divide n n n , and ∣ X ∣ = n |X|=n ∣ X ∣ = n . Conversely, these two conditions give both A X = n A AX=nA A X = n A and C n X = n C n C_nX=nC_n C n X = n C n by the cycle product rule. They are also necessary for the latter equation. For the product of the first k k k primes, both inputs use Θ ( log n ) = Θ ( k log k ) \Theta(\log n)=\Theta(k\log k) Θ ( log n ) = Θ ( k log k ) bits. Taking k = ⌊ c L / log L ⌋ k=\lfloor cL/\log L\rfloor k = ⌊ c L / log L ⌋ for a sufficiently small fixed c > 0 c>0 c > 0 gives the lower bound for every sufficiently large input budget L L L . In particular, when the gcd is unrestricted, the counting function has superpolynomial output length and lies outside # P \#\mathrm{P} # P .
Proposition C.3 (Finding a second quotient). Let A = C 2 g + C 3 g A=C_{2g}+C_{3g} A = C 2 g + C 3 g , with g ≥ 1 g\ge1 g ≥ 1 and A , B A,B A , B given by binary cycle lists. Deciding whether A X = B AX=B A X = B has at least two isomorphism classes of quotients and factoring a positive integer given in binary are equivalent under deterministic polynomial-time Turing reductions. The same equivalence holds for deciding whether there is exactly one quotient class. One can factor g g g with O ( log ( 2 g ) ) O(\log(2g)) O ( log ( 2 g )) queries to either decision oracle. In the other direction, one factorisation of g g g suffices to construct two distinct quotients whenever they exist, with polynomial bit complexity apart from that call.
Proof. Consider first B = k A B = kA B = k A , the disjoint union of k k k copies of A A A . For any nonempty permutation A A A , the quotients of A X = k A AX = kA A X = k A are the partitions of k k k into divisors of the gcd of all cycle lengths of A A A . Indeed ∣ X ∣ = k |X| = k ∣ X ∣ = k . For any cycle length a a a of A A A , its a a a th iterate has F a ( A ) > 0 F_a(A) > 0 F a ( A ) > 0 fixed points. Since F a ( A ) F a ( X ) = F a ( k A ) = k F a ( A ) F_a(A)F_a(X) = F_a(kA) = kF_a(A) F a ( A ) F a ( X ) = F a ( k A ) = k F a ( A ) , we have F a ( X ) = k F_a(X) = k F a ( X ) = k , so every quotient length divides a a a . The cycle product rule proves the converse. The single-cycle version is the restricted-partition example of Bridoux et al. when A = C g A = C_g A = C g and k = g k = g k = g [5 Appendix B, Lemma 13] .
For A = C 2 g + C 3 g A = C_{2g}+C_{3g} A = C 2 g + C 3 g with g > 1 g > 1 g > 1 , the all-ones partition is always available. The first k k k admitting a second partition is the least prime divisor of g g g . Every nonunit part is at least that prime, and a part of that size can be completed with ones. For example, when g = 15 g = 15 g = 15 the first change occurs at k = 3 k = 3 k = 3 , with quotients 3 C 1 3C_1 3 C 1 and C 3 C_3 C 3 . For a remaining factor h > 1 h > 1 h > 1 , use the divisor A h = C 2 h + C 3 h A_h = C_{2h} + C_{3h} A h = C 2 h + C 3 h . Query the targets k A h kA_h k A h at k = 2 , 4 , 8 , … k = 2, 4, 8, \ldots k = 2 , 4 , 8 , … , capping the last probe at h h h . The target at k = 1 k = 1 k = 1 has a unique quotient. The first probe admitting a second quotient brackets the least prime divisor p p p of h h h between the preceding value and the current one. The interval has length at most p p p , so binary search in it finds p p p in a total of O ( log p ) O(\log p) O ( log p ) queries, including the probes. Either oracle detects the change since k C 1 kC_1 k C 1 is always a quotient. Divide h h h by p p p and repeat until h = 1 h = 1 h = 1 . The primes found, with multiplicity, have product g g g . Summing their logarithms gives O ( log ( 2 g ) ) O(\log(2g)) O ( log ( 2 g )) queries in all, each of O ( log ( 2 g ) ) O(\log(2g)) O ( log ( 2 g )) bits.
The same first-change test with A = C g A = C_g A = C g already recovers the prime factors from one-cycle division. We now go in the other direction. Given B B B , replace each cycle in a putative quotient by copies of the shortest cycle with the same ordered pair of image lengths, as in Proposition B.2 . The resulting multiplicities form its representative vector . Two quotients may give different vectors, or they may give the same vector. We test each possibility.
Can the vector of representative multiplicities change? Split each block’s row and column multiplicities by (2), rejecting a failed split. For a row length u u u in block R R R , we have 2 g ∣ u 2g \mid u 2 g ∣ u and R = lcm ( u , 3 g ) R = \operatorname{lcm}(u,3g) R = lcm ( u , 3 g ) . Hence R / u = 3 g / gcd ( u , 3 g ) R/u = 3g/\gcd(u,3g) R / u = 3 g / g cd( u , 3 g ) divides 3. Likewise R / v R/v R / v divides 2 for every column length v v v . There are therefore at most two rows and two columns, as in the proof of Theorem 2.2 .
Measure each cell in quotient states . A quotient cycle C t C_t C t supplies gcd ( 2 g , t ) \gcd(2g,t) g cd( 2 g , t ) cycles of length lcm ( 2 g , t ) \operatorname{lcm}(2g,t) lcm ( 2 g , t ) to its row, or 2 g t 2gt 2 g t image states for its t t t quotient states. Row i i i needs u i ρ i u_i\rho_i u i ρ i image states for its ρ i \rho_i ρ i cycles of length u i u_i u i , so its sum in quotient states is r i = u i ρ i / ( 2 g ) r_i = u_i\rho_i/(2g) r i = u i ρ i / ( 2 g ) . In column j j j , the requirement of γ j \gamma_j γ j cycles of length v j v_j v j gives the sum c j = v j γ j / ( 3 g ) c_j = v_j\gamma_j/(3g) c j = v j γ j / ( 3 g ) . Use the quotas of this block, keeping the two shares at R R R separate. Pad a missing row or column with zeros. Reject nonintegral margins or unequal total sums.
For each attainable pair ( u i , v j ) (u_i,v_j) ( u i , v j ) , let s i j s_{ij} s ij be its least representative, computed as in Proposition B.2 . Its cell must contain a nonnegative multiple of s i j s_{ij} s ij : each copy of C s i j C_{s_{ij}} C s ij supplies that many quotient states to both margins. An unattainable or padded cell must be zero. Conversely, dividing the occupied cells by their representatives recovers a feasible multiplicity vector. Once the upper left cell x x x is chosen, the table is forced:
( x r 1 − x c 1 − x r 2 − c 1 + x ) , max ( 0 , c 1 − r 2 ) ≤ x ≤ min ( r 1 , c 1 ) . \left(\begin{array}{cc}
x & r_1-x \\
c_1-x & r_2-c_1+x
\end{array}\right), \qquad\max(0,c_1-r_2) \le x \le\min(r_1,c_1). ( x c 1 − x r 1 − x r 2 − c 1 + x ) , max ( 0 , c 1 − r 2 ) ≤ x ≤ min ( r 1 , c 1 ) .
Every attainable cell gives one congruence for x x x . For example, the upper right cell requires r 1 − x r_1-x r 1 − x to be divisible by s 12 s_{12} s 12 when that pair is attainable, so x ≡ r 1 ( m o d s 12 ) x \equiv r_1 \pmod{s_{12}} x ≡ r 1 ( mod s 12 ) . The generalised Chinese remainder theorem either detects a conflict or combines these congruences into a single residue class. Intersect it with the displayed interval and with the equalities from the zero cells. The first admissible value and, if present, the next one can be found by integer division. The combined modulus divides R R R , since each s i j s_{ij} s ij divides both of its image lengths. All these integers have O ( L ) O(L) O ( L ) bits for input bit length L L L . There are at most as many blocks as observed lengths. An empty block solution set rules out a quotient. Otherwise take the first value in each block. A second value in any block gives a second representative vector in polynomial bit time.
Can the same vector lift to two quotients? Suppose the representative vector z z z is unique. For instance, with A = C 10 + C 15 A = C_{10} + C_{15} A = C 10 + C 15 and B = 25 C 30 B = 25C_{30} B = 25 C 30 , both 5 C 6 5C_6 5 C 6 and C 30 C_{30} C 30 give B B B . Each C 6 C_6 C 6 supplies five target cycles and C 30 C_{30} C 30 supplies all twenty-five, so both choices give z 6 = 5 z_6 = 5 z 6 = 5 . When can shorter cycles be grouped in this way? For an ordered pair of output lengths u , v u, v u , v , write s s s for its least representative and m = gcd ( u , v ) m = \gcd(u,v) m = g cd( u , v ) . The periods giving this pair are precisely the multiples of s s s dividing m m m : necessity was shown in Proposition B.2 . For sufficiency, the lcm with the first divisor length lies between lcm ( 2 g , s ) = u \operatorname{lcm}(2g,s) = u lcm ( 2 g , s ) = u and u u u in the divisibility order. The same argument applies to v v v . Set H = m / s H = m/s H = m / s . A cycle of length s e se se , e ∣ H e \mid H e ∣ H , contributes exactly as much as e e e copies of C s C_s C s . Thus the lifts of z s z_s z s copies are exactly the partitions of z s z_s z s into divisors of H H H . Different ordered pairs have disjoint sets of periods, so a second lift exists precisely when, for at least one pair, H > 1 H > 1 H > 1 and the least prime divisor p p p of H H H satisfies p ≤ z s p \le z_s p ≤ z s . Replacing p p p copies of C s C_s C s by C p s C_{ps} C p s constructs it. Here m = gcd ( lcm ( 2 g , s ) , lcm ( 3 g , s ) ) = lcm ( g , s ) m = \gcd(\operatorname{lcm}(2g,s), \operatorname{lcm}(3g,s)) = \operatorname{lcm}(g,s) m = g cd( lcm ( 2 g , s ) , lcm ( 3 g , s )) = lcm ( g , s ) , so H = g / gcd ( g , s ) H = g/\gcd(g,s) H = g / g cd( g , s ) . One factorisation of g g g provides the primes to test for every pair. Each constructed list uses at most four representatives per block and one extra length p s ∣ m ps \mid m p s ∣ m . Its multiplicities have O ( L ) O(L) O ( L ) bits, since each representative copy contributes at least one target cycle. This completes the bit bound for distinguishing zero, one and at least two classes and returning the witnesses.
The same factoring equivalence holds for every fixed coprime pair of reduced lengths U , V U,V U , V , with A = C U g + C V g A = C_{Ug} + C_{Vg} A = C U g + C V g and variable g g g . The targets k A kA k A give exactly the same divisor partitions. In the upper bound Proposition B.2 gives an integer program with at most τ ( U ) τ ( V ) \tau(U)\tau(V) τ ( U ) τ ( V ) variables per block. Given one solution z z z , test each coordinate j j j in turn with the added bound z j ′ ≤ z j − 1 z'_j \le z_j - 1 z j ′ ≤ z j − 1 or z j ′ ≥ z j + 1 z'_j \ge z_j + 1 z j ′ ≥ z j + 1 , allowing all other coordinates of that block to vary. These fixed-dimensional tests find any alternative representative vector. For every representative s s s the identity gcd ( lcm ( U g , s ) , lcm ( V g , s ) ) = lcm ( g , s ) \gcd(\operatorname{lcm}(Ug,s),\operatorname{lcm}(Vg,s)) = \operatorname{lcm}(g,s) g cd( lcm ( U g , s ) , lcm ( V g , s )) = lcm ( g , s ) still holds.
A sharper bound for writing the successor tables
Theorem D.1. For the same routed graph as in Theorem 6.1 , one can choose the numerical weights so that both successor tables can be written in deterministic bit time exp ( O ( log ( s + 2 ) log log ( s + 3 ) ) ) \exp(O(\log(s+2)\log\log(s+3))) exp ( O ( log ( s + 2 ) log log ( s + 3 ))) , with the same bound on the number of states written. All conclusions about the divisor, the colouring and the three-copy margins continue to hold.
Recall that each graph address uses d = O ( log ( s + 2 ) ) d = O(\log(s+2)) d = O ( log ( s + 2 )) bits. The two-bit calculation in § 6 reduces the desired bound to a choice of small integers. If the factors q , z i q,z_i q , z i assigned to the bits are polynomial in d d d , the logarithm of each axis lcm is O ( d log d ) O(d\log d) O ( d log d ) . Two requirements constrain the choice. Short signed sums of address weights must distinguish the graph’s local conditions, and the weights on the second axis must avoid every prime dividing the first lcm q q q . The next lemma meets the first requirement whenever each bit has enough candidates. The sieve later supplies candidates that satisfy the second requirement as well.
Lemma D.2. Fix positive integers H , K H,K H , K and an integer J > 3 ⋅ 2 H J > 3 \cdot2^H J > 3 ⋅ 2 H . For each of d d d bits take a disjoint pool of J J J integers greater than one, all pairwise coprime across the union of the pools. For all sufficiently large d d d and any integer q > 0 q > 0 q > 0 , one can choose a z i z_i z i in each pool so that no relation ∑ x ∣ H b x U ( x ) = 0 \sum_{x \mid H} b_x U(x) = 0 ∑ x ∣ H b x U ( x ) = 0 has between one and H H H nonzero coefficients, all with ∣ b x ∣ ≤ K |b_x| \le K ∣ b x ∣ ≤ K . Here U ( x ) = q d − ∣ x ∣ ∏ i ∈ x z i U(x) = q^{d-\lvert x\rvert}\prod_{i\in x} z_i U ( x ) = q d − ∣ x ∣ ∏ i ∈ x z i . If the candidates and q q q are d O ( 1 ) d^{O(1)} d O ( 1 ) , deterministic search finds such a choice in exp ( O ( d log d ) ) \exp(O(d\log d)) exp ( O ( d log d )) bit operations.
Proof. Choose independently and uniformly from the pools. In any relation take an inclusion-minimal vanishing subsum, keeping its original nonzero coefficients. It has ℓ \ell ℓ distinct addresses with 2 ≤ ℓ ≤ H 2 \le\ell\le H 2 ≤ ℓ ≤ H . For example, for addresses 110, 111, 001 written in bit order 1, 2, 3, a relation with coefficients u , v , w u,v,w u , v , w reads
z 1 z 2 ( u q + v z 3 ) + w q 2 z 3 = 0. z_1z_2(uq+vz_3)+wq^2z_3=0. z 1 z 2 ( u q + v z 3 ) + w q 2 z 3 = 0.
Once z 3 z_3 z 3 is fixed this relation prescribes z 1 z 2 z_1z_2 z 1 z 2 . As no prime factor occurs in two pool entries, it even prescribes both choices separately. Bits 1 and 2 occur in exactly the same terms, the first two. In general we group bits by the set of terms in which they occur. Cancel the common factor from each bit on which all these addresses agree. There remain k ≥ 1 k \ge1 k ≥ 1 bits. Each bit selects the nonempty proper subset of the ℓ \ell ℓ terms in which it is one. Some subset occurs on a set F F F of at least k / 2 H k/2^H k / 2 H bits. With all other choices fixed, the equation becomes
A 1 ∏ i ∈ F z i + A 2 q ∣ F ∣ = 0. A_1 \prod_{i\in F} z_i + A_2q^{|F|}=0. A 1 i ∈ F ∏ z i + A 2 q ∣ F ∣ = 0.
If A 1 = 0 A_1=0 A 1 = 0 , the terms of that proper subset already sum to zero, contrary to minimality. Otherwise the equation prescribes the product uniquely. Each candidate has a prime factor shared by no other candidate, so this product prescribes every choice on F F F . The probability of this minimal relation is at most d − J k / 2 H d^{-Jk/2^H} d − J k / 2 H .
There are at most ( 2 K + 1 ) ℓ ( d k ) 2 ℓ k (2K+1)^\ell\binom{d}{k}2^{\ell k} ( 2 K + 1 ) ℓ ( k d ) 2 ℓ k possible lists of coefficients, surviving bit positions and bit patterns. Bits removed in the cancellation do not affect the event. Summing the probability bound over these lists and 2 ≤ ℓ ≤ H 2\le\ell\le H 2 ≤ ℓ ≤ H gives at most
O H , K ( ∑ k = 1 d ( 2 H d 1 − J / 2 H ) k ) = o ( 1 ) . O_{H,K}\left(\sum_{k=1}^{d}\left(2^H d^{1-J/2^H}\right)^k\right)=o(1). O H , K ( k = 1 ∑ d ( 2 H d 1 − J / 2 H ) k ) = o ( 1 ) .
For deterministic construction, try all d J d d^{Jd} d J d choices. For each, there are O H , K ( 2 H d ) O_{H,K}(2^{Hd}) O H , K ( 2 H d ) possible relations, and each can be tested using integers of O ( d log d ) O(d\log d) O ( d log d ) bits.
Proof of Theorem D.1. Use the routed graph, slots, coefficients ρ , ν \rho,\nu ρ , ν and preliminary row lcm R R R of Section 6. Their slot counts, coefficient bounds and the possible values of R R R are bounded by absolute constants. Fix H = 30 H=30 H = 30 , choose a constant K K K at least H H H times the largest slot coefficient on either axis, and fix J J J as in the lemma. Already H = 30 H=30 H = 30 requires J > 3 ⋅ 2 30 J>3\cdot2^{30} J > 3 ⋅ 2 30 in the search through d J d d^{Jd} d J d choices. The time bound is asymptotic. On each axis we will put q < z i ≤ q ( 1 + η / d ) q<z_i\le q(1+\eta/d) q < z i ≤ q ( 1 + η / d ) , with η = 10 − 8 \eta=10^{-8} η = 1 0 − 8 . Then 1 ≤ U ( x ) / q d ≤ e η < 1 + 10 − 7 1\le U(x)/q^d\le e^\eta<1+10^{-7} 1 ≤ U ( x ) / q d ≤ e η < 1 + 1 0 − 7 . The lemma supplies the address independence used in Appendix A; the slot and scale calculations there apply with these new multipliers.
Column weights. Choose a fixed integer E 0 > J + 3 E_0>J+3 E 0 > J + 3 . The prime number theorem in the progression 1 m o d R 1\bmod R 1 mod R supplies ≫ R d E 0 / log d \gg_R d^{E_0}/\log d ≫ R d E 0 / log d primes in [ d E 0 , 2 d E 0 ] [d^{E_0},2d^{E_0}] [ d E 0 , 2 d E 0 ] [3 Theorem 1.3] . Only finitely many R R R occur, so a common lower bound suffices. Partition the interval into O η ( d ) O_\eta(d) O η ( d ) pieces of length at most η d E 0 / d \eta d^{E_0}/d η d E 0 / d . Some piece contains at least 1 + d J + 1 1+d^{J+1} 1 + d J + 1 of the primes for large d d d . Use its smallest prime as q q q , divide d J + 1 d^{J+1} d J + 1 of the others into pools and apply Lemma D.2. Since q q q and every z i z_i z i equal one modulo R R R , all column weights again equal one modulo R R R . Their lcm a a a is coprime to R R R .
Every column weight divides q d ∏ i z i q^d\prod_i z_i q d ∏ i z i times the product of the distinct positive residual factors c c c and c 1 q + c 2 z i c_1q+c_2z_i c 1 q + c 2 z i from Section 6. There are O ( d ) O(d) O ( d ) such factors and each is d O ( 1 ) d^{O(1)} d O ( 1 ) . In particular log a = O ( d log d ) \log a=O(d\log d) log a = O ( d log d ) , and every prime dividing a a a is at most d C 1 d^{C_1} d C 1 for an absolute constant C 1 C_1 C 1 .
Row weights. Fix b 0 > max ( C 1 , J + 3 ) b_0>\max(C_1,J+3) b 0 > max ( C 1 , J + 3 ) and put Z = d b 0 Z=d^{b_0} Z = d b 0 . Choose a prime q ∈ [ d E , 2 d E ] q\in[d^E,2d^E] q ∈ [ d E , 2 d E ] for a sufficiently large fixed integer E > b 0 + 1 E>b_0+1 E > b 0 + 1 specified below, so q > Z q>Z q > Z . We seek d J + 1 d^{J+1} d J + 1 pairwise coprime integers in I = ( q , q ( 1 + η / d ) ] I=(q,q(1+\eta/d)] I = ( q , q ( 1 + η / d )] from which to form the row pools. Let L = ∣ I ∩ Z ∣ L=|I\cap\mathbb{Z}| L = ∣ I ∩ Z ∣ , so L ≍ d E − 1 L\asymp d^{E-1} L ≍ d E − 1 . We sieve out all small prime factors so that choosing one survivor discards few others. At primes dividing a a a we must also protect the row weights. These are two separate steps. The sieve gives many admissible integers in the interval. A greedy selection among the survivors then ensures that no two chosen integers share a prime. For each prime p ≤ Z p\le Z p ≤ Z forbid the residue zero. When p ∣ a p\mid a p ∣ a , also forbid the zeros modulo p p p of each affine form c 1 q + c 2 z c_1q+c_2z c 1 q + c 2 z that can occur in a row weight at two neighbouring addresses. Use all coefficient pairs that actually occur, in their order at the zero and one ends of the flipped bit. At z = q z=q z = q this form has value ( c 1 + c 2 ) q = u ˉ i q (c_1+c_2)q=\bar{u}_iq ( c 1 + c 2 ) q = u ˉ i q , where u ˉ i ∣ R \bar{u}_i\mid R u ˉ i ∣ R is that row’s preliminary weight. Thus q m o d p q\bmod p q mod p avoids every forbidden residue, and none of the forms is identically zero modulo p p p . A one-address weight has residual factor c = u ˉ i c=\bar{u}_i c = u ˉ i , already coprime to a a a . The number ρ ( p ) \rho(p) ρ ( p ) of forbidden residues therefore satisfies ρ ( p ) ≤ min ( κ , p − 1 ) \rho(p)\le\min(\kappa,p-1) ρ ( p ) ≤ min ( κ , p − 1 ) for an absolute κ \kappa κ , independent of d d d and E E E .
Let E p E_p E p be the integers in I I I hitting a forbidden residue modulo p p p , put g ( p ) = ρ ( p ) / p g(p)=\rho(p)/p g ( p ) = ρ ( p ) / p , and write V = ∏ p ≤ Z ( 1 − g ( p ) ) V=\prod_{p\le Z}(1-g(p)) V = ∏ p ≤ Z ( 1 − g ( p )) . Mertens’ estimate for the prime reciprocal sum gives V ≫ κ ( log Z ) − κ V\gg_\kappa(\log Z)^{-\kappa} V ≫ κ ( log Z ) − κ and, on any subinterval of primes from w w w to z z z , the inverse product is ≪ κ ( log z / log w ) κ \ll_\kappa(\log z/\log w)^\kappa ≪ κ ( log z / log w ) κ . Indeed for p > 2 κ p>2\kappa p > 2 κ each logarithm is at most κ / p + O κ ( p − 2 ) \kappa/p+O_\kappa(p^{-2}) κ / p + O κ ( p − 2 ) , while the remaining primes contribute a bounded factor. Set z = ⌊ Z ⌋ + 1 2 z=\lfloor Z\rfloor+\frac{1}{2} z = ⌊ Z ⌋ + 2 1 and P ( z ) = ∏ p < z p P(z)=\prod_{p<z}p P ( z ) = ∏ p < z p , so p < z p<z p < z selects exactly the primes p ≤ Z p\le Z p ≤ Z . For e ∣ P ( z ) e\mid P(z) e ∣ P ( z ) put ρ ( e ) = ∏ p ∣ e ρ ( p ) \rho(e)=\prod_{p\mid e}\rho(p) ρ ( e ) = ∏ p ∣ e ρ ( p ) and extend g g g multiplicatively, so g ( e ) = ρ ( e ) / e g(e)=\rho(e)/e g ( e ) = ρ ( e ) / e . The Chinese remainder theorem gives L g ( e ) + r e Lg(e)+r_e Lg ( e ) + r e integers hitting every E p E_p E p with p ∣ e p\mid e p ∣ e , with ∣ r e ∣ ≤ ρ ( e ) |r_e|\le\rho(e) ∣ r e ∣ ≤ ρ ( e ) .
At sieve level z u z^u z u , the fundamental lemma gives the following lower bound for the number of survivors, for sufficiently large fixed u ≥ 9 κ + 1 u\ge9\kappa+1 u ≥ 9 κ + 1 [28 Corollary 19] .
# { n ∈ I ∩ Z : n ∉ E p for all p ≤ Z } ≥ 1 2 L V − O ( ∑ e ∣ P ( z ) e ≤ z u ∣ r e ∣ ) . \#\{n\in I\cap\mathbb{Z}:n\notin E_p\text{ for all }p\le Z\}\ge\frac{1}{2}LV-O\left(\sum_{\substack{e\mid P(z)\\e\le z^u}}|r_e|\right). # { n ∈ I ∩ Z : n ∈ / E p for all p ≤ Z } ≥ 2 1 L V − O e ∣ P ( z ) e ≤ z u ∑ ∣ r e ∣ .
To use the divisibility formulation of Tao and Teräväinen [29, Lemma 5.1, p. 1338], associate to each integer of I I I the product of the primes at which it hits a forbidden class, counting repeated products with their multiplicities. Divisibility by e e e counts precisely the simultaneous hits above. The dimension bound depends only on κ \kappa κ , so u u u can be fixed before the interval exponent E E E is chosen. Since ρ ( e ) ≤ κ ω ( e ) ≤ e log 2 κ \rho(e)\le\kappa^{\omega(e)}\le e^{\log_2\kappa} ρ ( e ) ≤ κ ω ( e ) ≤ e l o g 2 κ , the total remainder is O κ , u ( Z u ( 1 + log 2 κ ) ) O_{\kappa,u}(Z^{u(1+\log_2\kappa)}) O κ , u ( Z u ( 1 + l o g 2 κ ) ) . Now choose E > 2 + b 0 u ( 1 + log 2 κ ) E>2+b_0u(1+\log_2\kappa) E > 2 + b 0 u ( 1 + log 2 κ ) . We obtain ≫ κ L / ( log Z ) κ \gg_\kappa L/(\log Z)^\kappa ≫ κ L / ( log Z ) κ survivors.
Every survivor has only O E , b 0 ( 1 ) O_{E,b_0}(1) O E , b 0 ( 1 ) prime divisors, all greater than Z Z Z . Choosing one survivor and removing all those sharing a prime with it costs O E , b 0 ( 1 + L / Z ) O_{E,b_0}(1+L/Z) O E , b 0 ( 1 + L / Z ) candidates. Greedy selection therefore yields ≫ Z / ( log Z ) κ > d J + 1 \gg Z/(\log Z)^\kappa>d^{J+1} ≫ Z / ( log Z ) κ > d J + 1 pairwise coprime integers for large d d d . Split this common supply into the d d d pools and use Lemma D.2. Every row weight is coprime to a a a , since its bit factors and residual factor avoid all p ∣ a p\mid a p ∣ a . The same common-multiple calculation gives log b = O ( d log d ) \log b=O(d\log d) log b = O ( d log d ) for the row lcm b b b .
All primes required here can be found by trial division up to polynomial bounds in d d d , including the prime divisors of a a a . Bertrand’s postulate supplies the row prime q q q . Scanning the intervals, testing forbidden classes and selecting the pools likewise take d O ( 1 ) d^{O(1)} d O ( 1 ) bit operations apart from reading the routed graph. For small d d d , append unused address bits and repeat if a pool or a relation test leaves no admissible choice. The estimates above give a uniform threshold d 0 d_0 d 0 that works for every permitted choice of slots. Starting at d i n d_{\mathrm{in}} d in bits, the first successful trial uses at most max ( d i n , d 0 ) \max(d_{\mathrm{in}},d_0) max ( d in , d 0 ) bits. The search need not know d 0 d_0 d 0 . Both exhaustive pool searches fit in exp ( O ( d log ( d + 2 ) ) ) \exp(O(d\log(d+2))) exp ( O ( d log ( d + 2 ))) time.
How many successors must we write? All the cycle lengths and multiplicities of the target are fixed by the routed graph. To count its states, take one triple h h h in Section 4. The weights of its first pair of main rows sum to L h = p h + q h L_h=p_h+q_h L h = p h + q h , as do the weights of its second pair. Including the incidence rows F h t F_{ht} F h t , the contribution of this triple to the weighted sum of row targets is
L h ∑ t ∈ h B t + L h ∑ t ∈ h ( H t − B t ) + ∑ t ∈ h ( T t − L h ) H t = ∑ t ∈ h T t H t . L_h\sum_{t\in h}B_t+L_h\sum_{t\in h}(H_t-B_t)+\sum_{t\in h}(T_t-L_h)H_t=\sum_{t\in h}T_tH_t. L h t ∈ h ∑ B t + L h t ∈ h ∑ ( H t − B t ) + t ∈ h ∑ ( T t − L h ) H t = t ∈ h ∑ T t H t .
Each element t t t occurs in three triples. On the column side the two weights X t , c X_{t,c} X t , c and Y t , c Y_{t,c} Y t , c add to H t H_t H t , both columns have target T t T_t T t , and there are three colours c c c . Thus ∑ i u i R i = ∑ j v j S j = 3 ∑ t T t H t \sum_i u_iR_i=\sum_jv_jS_j=3\sum_tT_tH_t ∑ i u i R i = ∑ j v j S j = 3 ∑ t T t H t . Substituting these two sums into the state count of Section 6 gives
N = ∣ A ∣ + ∣ B ∣ = a + b + a ∑ i u i R i + b ∑ j v j S j = ( a + b ) ( 1 + 3 ∑ t T t H t ) . (7) N=|A|+|B|=a+b+a\sum_i u_iR_i+b\sum_jv_jS_j=(a+b)\left(1+3\sum_tT_tH_t\right). \tag*{(7)} N = ∣ A ∣ + ∣ B ∣ = a + b + a i ∑ u i R i + b j ∑ v j S j = ( a + b ) ( 1 + 3 t ∑ T t H t ) . (7)
This calculation uses only the prescribed margins, so it applies even when the graph has no proper three-edge-colouring. There are O ( s d ) O(sd) O ( s d ) elements t t t , and each of a a a , b b b , T t T_t T t , H t H_t H t has O ( d log ( d + 2 ) ) O(d\log(d+2)) O ( d log ( d + 2 )) bits. Hence log N = O ( log ( s + 2 ) + d log ( d + 2 ) ) \log N = O(\log(s+2) + d\log(d+2)) log N = O ( log ( s + 2 ) + d log ( d + 2 )) . Writing a successor index for each state in both tables takes O ( N log ( 2 N ) ) O(N\log(2N)) O ( N log ( 2 N )) bit operations. Since d = O ( log ( s + 2 ) ) d = O(\log(s+2)) d = O ( log ( s + 2 )) , this fits in the claimed exp ( O ( log ( s + 2 ) log log ( s + 3 ) ) ) \exp(O(\log(s+2)\log\log(s+3))) exp ( O ( log ( s + 2 ) log log ( s + 3 ))) time. Lemmas 4.1 and 3.1 give the colouring equivalence and the three-copy condition.
The number of states required by this encoding. There is a matching lower bound on the sizes of these successor tables. On each axis the construction assigns a distinct weight to each edge of G ′ G' G ′ , as observed in § 6 . Each row weight divides b b b , and each column weight divides a a a . Thus for m = a m=a m = a and for m = b m=b m = b we have τ ( m ) ≥ ∣ E ( G ′ ) ∣ ≥ ∣ E ( G ) ∣ = 3 s / 5 \tau(m) \ge|E(G')| \ge|E(G)| = 3s/5 τ ( m ) ≥ ∣ E ( G ′ ) ∣ ≥ ∣ E ( G ) ∣ = 3 s /5 . In particular m ≥ 3 s / 5 m \ge3s/5 m ≥ 3 s /5 . Using the divisor estimate of Lemma 2.1 in the form log τ ( m ) = O ( log m / log log m ) \log\tau(m) = O(\log m/\log\log m) log τ ( m ) = O ( log m / log log m ) , we obtain log m = Ω ( log s log log s ) \log m = \Omega(\log s\log\log s) log m = Ω ( log s log log s ) as s s s grows. The explicit divisor alone therefore has exp ( Ω ( log s log log s ) ) \exp(\Omega(\log s\log\log s)) exp ( Ω ( log s log log s )) states. Combined with the upper bound, the total size is exp ( Θ ( log s log log s ) ) \exp(\Theta(\log s\log\log s)) exp ( Θ ( log s log log s )) . This lower bound applies to encodings that retain a distinct divisor weight per edge on an axis.