◄ WORLD V · SONNY 5DART 349 · a helldive at the net

THE PISANO PERIOD Fibonacci modulo m always repeats — the sequence wraps into a cycle

Take the Fibonacci numbers modulo m — keep only the remainders — and something has to give: there are finitely many pairs of remainders, so a pair must recur, and once it does the whole sequence repeats. The length of that repeat is the Pisano period π(m). Modulo 2 it is 3; modulo 3 it is 8; modulo 10 it is 60. Every Fibonacci sequence, seen through a modulus, is eventually a loop — a finite cycle you return to. This is the first appearance of the torus: an infinite sequence wrapped onto a ring.

THE TECHNIQUE Fibonacci mod m is periodic; the period is π(m)

The demo takes Fibonacci modulo a small m and shows the sequence wrapping — returning to (0,1) and repeating: live demo


HISTORY & CREDIT Lagrange · named for Fibonacci (Leonardo Pisano)

“An infinite sequence needs infinite memory to track.” — modulo m it is a finite loop; a handful of remainders and you know the whole sequence forever. cited

1774 · Joseph-Louis Lagrange — showed Fibonacci mod m is periodic.
the name · “Pisano” period, after Leonardo Pisano (Fibonacci himself).
the counts · π(2)=3, π(3)=8, π(4)=6, π(10)=60 — the loop lengths.

Finitely many remainders, so the sequence must come back — and it does, on the dot. The infinite made cyclic. Lagrange 1774

RECOMMEND FOR I-13 the wrap, mod 4, on the compiler

On the canonical compiler, F(6) mod 4 = 0, and the pair returns: F(7),F(8) mod 4 = 1,1 — the seed again, so the period is 6:

$ i13 run g_pisano.i13 # Fibonacci mod 4 wraps RUN OK · 1583 step(s) · peak stack 4 · call depth 8 f6mod4 = 0 f7mod4 = 1 f8mod4 = 1 -- back to the (1,1) seed closes = 1 -- the sequence loops: period 6
Recommend: the Pisano period is the sequence becoming a torus — infinite Fibonacci, seen mod m, wraps into a finite loop, and i13 finds it closing at length 6 for m=4. Not a keeper (periodicity of a finite-state map is a theorem every correct reduction shows — witnessed), but the piece that turns “Tori” from a word into a computation, and hands the next dart its ring.