Frieze Patterns
A Conway-Coxeter frieze pattern of order n is an array of positive integers arranged in rows, where the top and bottom rows are all 1s, and every adjacent 2 x 2 submatrix a&b c&d satisfies the unim...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Any positive real number $x$ can be decomposed into integer and fractional parts $\lfloor x \rfloor + \{x\}$, where $\lfloor x \rfloor$ (the floor function) is an integer, and $0\le \{x\} < 1$.
For positive integers $k$ and $n$, define the function \begin{align*} f_k(n) = \sum_{i=1}^{n}\left\{ \frac{i^k}{n} \right\} \end{align*} For example, $f_5(10)=4.5$ and $f_7(1234)=616.5$.
Let \begin{align*} S(N) = \sum_{\substack{k=1 \\ k\text{ odd}}}^{N} \sum_{n=1}^{N} f_k(n) \end{align*} You are given that $S(10)=100.5$ and $S(10^3)=123687804$.
Find $\lfloor S(33557799775533) \rfloor$. Give your answer modulo $977676779$.
Problem 850: Frieze Patterns
Mathematical Analysis
Frieze-Triangulation Correspondence
Theorem (Conway-Coxeter, 1973). There is a bijection between frieze patterns of order and triangulations of a convex -gon. Consequently:
where is the -th Catalan number.
Proof sketch. Given a triangulation of an -gon, label edges with positive integers determined by the triangulation structure. The unimodular rule corresponds to the adjacency condition in the triangulation. The bijection sends each triangle to a row of the frieze.
The Unimodular Rule
Lemma. The condition for every diamond is equivalent to saying the entries in row determine all subsequent rows via:
where are known neighbors and is the new entry. The integrality of is guaranteed by the unimodular condition.
Catalan Number Properties
Theorem. The Catalan numbers satisfy:
- Recurrence: , with .
- Generating function: .
- Asymptotics: .
Concrete Examples
| Triangulations of -gon | ||
|---|---|---|
| 2 | 1 (triangle) | 1 |
| 3 | 2 (square: 2 diagonals) | 2 |
| 4 | 5 (pentagon) | 5 |
| 5 | 14 (hexagon) | 14 |
| 6 | 42 | 42 |
| 10 | 4862 | 4862 |
Verification for (square): The two triangulations of a square give frieze rows: and in the interior. Both satisfy .
Quiddity Sequences
Definition. The quiddity sequence of a frieze pattern is the first non-trivial row . A sequence is a valid quiddity sequence iff all entries generated by the unimodular rule are positive integers.
Theorem. Valid quiddity sequences of length with entries correspond bijectively to triangulations of the -gon, where equals the number of triangles incident to vertex .
Complexity Analysis
- Direct Catalan computation: using the formula .
- Catalan mod prime : with factorial precomputation.
- Enumerating frieze patterns: via recursive triangulation generation.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll power(ll b, ll e, ll m) { ll r=1; b%=m; while(e>0){if(e&1)r=r*b%m; b=b*b%m; e>>=1;} return r; }
ll catalan_mod(int n, ll mod) {
ll num = 1, den = 1;
for (int i = 2*n; i > n; i--) num = num * i % mod;
for (int i = 1; i <= n; i++) den = den * i % mod;
return num % mod * power(den, mod-2, mod) % mod * power(n+1, mod-2, mod) % mod;
}
int main() {
// F(n) = C_{n-1}
assert(catalan_mod(0, MOD) == 1);
assert(catalan_mod(1, MOD) == 1);
assert(catalan_mod(2, MOD) == 2);
assert(catalan_mod(3, MOD) == 5);
assert(catalan_mod(4, MOD) == 14);
cout << catalan_mod(999, MOD) << endl;
return 0;
}
"""
Problem 850: Frieze Patterns
Count Conway-Coxeter frieze patterns of order n.
F(n) = C_{n-1} = Catalan number.
"""
from math import comb
MOD = 10**9 + 7
def catalan(n):
"""Compute n-th Catalan number."""
return comb(2*n, n) // (n + 1)
def catalan_mod(n, mod):
"""Compute C_n mod p."""
num = 1
for i in range(2*n, n, -1):
num = num * i % mod
den = 1
for i in range(1, n+1):
den = den * i % mod
return num * pow(den, mod-2, mod) % mod * pow(n+1, mod-2, mod) % mod
def frieze_count(n):
return catalan(n - 1)
# Verify
assert catalan(0) == 1
assert catalan(1) == 1
assert catalan(2) == 2
assert catalan(3) == 5
assert catalan(4) == 14
for n in range(2, 12):
assert frieze_count(n) == catalan(n-1)
# Enumerate triangulations of polygon (for verification)
def count_triangulations(n_vertices):
"""Count triangulations of convex n-gon via Catalan recurrence."""
if n_vertices < 3: return 1 if n_vertices <= 2 else 0
return catalan(n_vertices - 2)
for nv in range(3, 10):
assert count_triangulations(nv) == catalan(nv - 2)
print("Verification passed!")
answer = catalan_mod(999, MOD)
print(f"Answer: {answer}")