Skip to content

Instantly share code, notes, and snippets.

@menjaraz
Last active June 6, 2026 15:09
Show Gist options
  • Select an option

  • Save menjaraz/aa83b533b753e1246eb89de635a43eb9 to your computer and use it in GitHub Desktop.

Select an option

Save menjaraz/aa83b533b753e1246eb89de635a43eb9 to your computer and use it in GitHub Desktop.
Z₇₁ Cyclic Dynamical System with Nontrivial 1-Cocycle Invariant

Minimal 71-State Cyclic System with Additive Cocycle Invariant

This repository contains a minimal deterministic dynamical system over the cyclic group Z₇₁ with a nontrivial additive edge-weight function (cocycle).

It produces two global invariants:

  • Period = 71
  • Drift = 118

System Overview

The system is defined on a finite state space:

S = Z₇₁

Transition rule

Each state advances deterministically:

x → x + 1 (mod 71)

This forms a single directed cycle over all 71 states.

Strongly Connected Component (SCC)

The entire state space forms one SCC:

  • Every state can reach every other state via repeated transitions
  • The SCC is exactly a 71-cycle
  • No branching or additional components exist

Cocycle (Edge Weights)

Each transition carries an integer weight w(x → x+1).

The weight function is defined so that the total sum over one full cycle is:

Σ w(x) = 118

This defines a nontrivial additive cocycle over the cycle.

Invariants

Running the system from any starting point yields:

  • Cycle length (period): 71
  • Total accumulated drift: 118

These are invariant under choice of start state.

Mathematical Interpretation

This system is an instance of:

  • A finite cyclic group action (Z₇₁)
  • Equipped with a discrete 1-cocycle
  • With invariant given by integration over the unique SCC cycle

Formally:

(Z₇₁, +1, w)

where the SCC structure and cocycle define a global invariant pair (P, Δ).

Key takeaway

A deterministic system over a finite cyclic graph can carry nontrivial global invariants beyond its period, captured by edge-weight cocycles.

// ============================================================
// MINIMAL EULER INVARIANT SYSTEM (P = 71, Δ = 118)
// ============================================================
//
// State space: Z_71
// Dynamics : x -> x + 1 mod 71
// Weight : fixed cocycle w(x)
// Invariant : sum over full cycle = 118
//
// This is a pure cyclic group + additive cocycle system.
// SCC structure is exactly one 71-cycle.
// ============================================================
const N: usize = 71;
// ------------------------------------------------------------
// STEP FUNCTION: pure cycle on Z_71
// ------------------------------------------------------------
fn step(x: usize) -> usize {
(x + 1) % N
}
// ------------------------------------------------------------
// COCYCLE (edge weights)
// Must satisfy: sum_{x=0..70} w(x) = 118
// ------------------------------------------------------------
fn weight(x: usize) -> i64 {
match x {
0..=9 => 2, // 10 * 2 = 20
10..=19 => 2, // 20
20..=29 => 2, // 20
30..=39 => 2, // 20
40..=49 => 2, // 20
50..=59 => 2, // 20 -> subtotal 120
60..=69 => -1, // 10 * -1 = -10 -> 110
70 => 8, // +8 -> 118 total
_ => 0,
}
}
// ------------------------------------------------------------
// ANALYZE SINGLE CYCLE (SCC is trivial)
// ------------------------------------------------------------
fn analyze(start: usize) {
let mut seen = vec![-1i32; N];
let mut x = start;
let mut t: usize = 0;
let mut sum: i64 = 0;
loop {
if seen[x] != -1 {
println!("Period = {}", t - seen[x] as usize);
println!("Drift = {}", sum);
return;
}
seen[x] = t as i32;
sum += weight(x);
x = step(x);
t += 1;
}
}
// ------------------------------------------------------------
fn main() {
analyze(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment