# Triangular and pentagonal chains: 1, 2, ..., n in a row with every neighbouring sum triangular

Open problem settled, formally verified in Lean 4. Vamshi Jandhyala.

> 1, 2, …, n can be lined up so that neighbours sum to triangular numbers for n = 2 and every n ≥ 9, and closed into a loop for n ≥ 12 except 14; the pentagonal analogue too. Berlekamp and Guy asked for proofs.

Canonical: https://vamshij.com/research/triangular-pentagonal-chains
Code and Lean proofs: https://github.com/jvvk/mathematics/tree/main/triangular-pentagonal-chains
Paper (PDF): https://github.com/jvvk/mathematics/blob/main/triangular-pentagonal-chains/paper/trichains.pdf

Can the numbers `1, 2, ..., n` be written in a row so that every two neighbours add up to a triangular number? Berlekamp and Guy (*Fibonacci plays billiards*, Crux Math. 46(8), 2020, pp. 334-347, [arXiv:2002.03705](https://arxiv.org/abs/2002.03705); the manuscript dates from 2003) found such a chain for `n = 2` and for every `n` from 9 to 70, and a closed loop (necklace) for `12 ≤ n ≤ 70` except `n = 14`, and wrote on p. 343 that they would like to see proofs. They also reported that chains with generalized pentagonal sums `k(3k-1)/2` seem to exist for all `n ≥ 4` and necklaces for all `n ≥ 9` (pp. 344-345). The counts of triangular chains are in [OEIS A116980](https://oeis.org/A116980) up to `n = 35`.

All four statements hold for every `n` (Theorems 1 and 2). The proof inflates a chain on `1, ..., n` to one on about `49n` numbers using `49 T_k + 6 = T_{7k+3}` (for pentagonal sums, `49 P_k + 2 = P_{7k-1}`), and stitches 49 inflated copies together with the numbers `1, ..., 27`. It follows the scheme Gerbicz used for perfect squares (2018); for triangular numbers it becomes simpler, because every number can be kept at a position of its own parity. The finite ingredients are a base of chains for `54 ≤ N ≤ 2673` (pentagonal: `60 ≤ N ≤ 2965`), 98 stitching arrangements, and the small cases.

Preprint v1, 20 November 2026, not peer reviewed; released before the author's own line-by-line reading. Zenodo: [doi:10.5281/zenodo.24397796](https://doi.org/10.5281/zenodo.24397796), identical to this folder at tag `triangular-pentagonal-chains-v1`. What is verified how: the induction (inflation identity, the stitching step for general `n`, validity of all 98 arrangements, the small chains and necklaces, and the existence halves of both theorems, conditional on the base chains) is formalised in Lean 4 (`lean/`, standard axioms only), with the base chains as an explicit hypothesis `BaseHyp`, because 3.6 and 4.4 million numbers are too many to state as Lean data. The base chains, the arrangements and the small cases are checked by an independent program that shares no code with the generators, and the nonexistence claims for small `n` by two different searches. The author used AI tools (Claude, Anthropic, to find the arguments and write the code, Lean and text; Codex, OpenAI, to search the literature and to review the draft and the release) and is responsible for the content.