Coloured Configurations
Consider a graph formed by taking two complete graphs K_a and K_b that share exactly one common edge. Count the number of valid n -colourings of this graph, for (a, b, n) = (25, 75, 1984). Give the...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Consider graphs built with the units \(A\):
and \(B\):
, where the units are glued along the vertical edges as
in the graph
.
A configuration of type \((a, b, c)\) is a graph thus built of \(a\) units \(A\) and \(b\) units \(B\), where the graph’s vertices are coloured using up to \(c\) colours, so that no two adjacent vertices have the same colour.
The compound graph above is an example of a configuration of type \((2,2,6)\), in fact of type \((2,2,c)\) for all \(c \ge 4\).
Let \(N(a, b, c)\) be the number of configurations of type \((a, b, c)\).
For example, \(N(1,0,3) = 24\), \(N(0,2,4) = 92928\) and \(N(2,2,3) = 20736\).
Find the last \(8\) digits of \(N(25,75,1984)\).
Problem 194: Coloured Configurations
Mathematical Foundation
Theorem 1. (Chromatic Polynomial of .) The number of proper -colourings of the complete graph is the falling factorial
Proof. In a proper colouring of , every pair of vertices must receive distinct colours. Assign colours greedily: the first vertex has choices, the second , …, the -th vertex has choices. Since has all edges, every greedy assignment is valid and every valid colouring arises exactly once.
Theorem 2. (Clique Separator Theorem.) If where is a clique , then
Proof. Let with , and induces a clique in both and . For any proper colouring of , the restriction is a proper colouring of . Conversely, for a fixed proper colouring of :
-
The number of extensions of to all of is , since every colouring of restricts to some colouring of , and by symmetry (all colourings of are equivalent under colour permutation in terms of extension count), each colouring of has exactly extensions.
-
Similarly, the number of extensions of to is .
Since and are disjoint and share no edges, the extensions are independent. Summing over all colourings of :
Lemma 1. (Application.) For with (a shared edge):
Proof. By Theorems 1 and 2 with :
Since , the factor cancels exactly.
Editorial
Count proper n-colourings of graph formed by K_a and K_b sharing one edge. (a, b, n) = (25, 75, 1984), mod 10^8. P(G, n) = n^{down a} * n^{down b} / n^{down 2} = (n-2)^{down (a-2)} * n^{down b}. We iterate over i from 0 to a-3. Finally, iterate over i from 0 to b-1.
Pseudocode
Compute (n-2)^{underline{a-2}} mod mod
for i from 0 to a-3
Multiply by n^{underline{b}} mod mod
for i from 0 to b-1
Complexity Analysis
- Time: modular multiplications. For , this is 98 multiplications.
- Space: .
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
// P(G, n) = n^{down a} * n^{down b} / n^{down 2}
// = (n-2)^{down (a-2)} * n^{down b}
// (a, b, n) = (25, 75, 1984), mod 10^8
const long long MOD = 100000000;
int a = 25, b = 75, n = 1984;
// Compute (n-2)^{down (a-2)} = 1982 * 1981 * ... * 1960
long long result = 1;
for (int i = 0; i < a - 2; i++) {
result = (result * ((n - 2 - i) % MOD)) % MOD;
}
// Multiply by n^{down b} = 1984 * 1983 * ... * 1910
for (int i = 0; i < b; i++) {
result = (result * ((n - i) % MOD)) % MOD;
}
cout << result << endl;
return 0;
}
"""
Problem 194: Coloured Configurations
Count proper n-colourings of graph formed by K_a and K_b sharing one edge.
(a, b, n) = (25, 75, 1984), mod 10^8.
P(G, n) = n^{down a} * n^{down b} / n^{down 2} = (n-2)^{down (a-2)} * n^{down b}
"""
def solve():
MOD = 10**8
a, b, n = 25, 75, 1984
result = 1
# (n-2) falling factorial (a-2) terms
for i in range(a - 2):
result = result * (n - 2 - i) % MOD
# n falling factorial b terms
for i in range(b):
result = result * (n - i) % MOD
return result
answer = solve()
assert answer == 0
print(answer)