# Which cycle? A reproducible census of the 3n-1 map for starting values up to one million This repository holds a short worked example paper and the two Python scripts that reproduce every result in it. It was written for certXiv (https://certxiv.org) to show how a known starter problem can be extended into a small, honest paper. **This is certXiv's teaching example. It is not a journal article, and it must not be submitted as anyone's own work. It has not been reviewed and has no score.** A paper you submit must answer your own question. ## The result in one line Under the map T(n) = n/2 for even n and 3n-1 for odd n, every start from 1 to 1,000,000 enters one of the three known cycles: 327679 enter the cycle of 1, 323351 the cycle of 5 and 348970 the cycle of 17. The slowest start is 858341, which takes 553 steps to reach a cycle. The paper makes no claim about starts above 1,000,000, does not claim the result is new, and does not claim the conjecture that every start enters one of these three cycles, which is unproved. ## How to run ``` python3 verify_1_starter.py python3 verify_2_census.py ``` Run both commands from the folder that holds the scripts. To see the exit status, run `echo $?` straight after each command: 0 means PASS. Each script compares its results (the starter answer; the counts in Table 1, the three cycle lengths and the slowest start) with the values stated in the paper. It exits with status 0 and prints `PASS` if they agree, and exits with status 1 and prints a line beginning `FAIL` if they do not. (If the slow cross-check or the rebuilding of a cycle meets an unexpected trajectory, the script stops with a Python error instead, which also exits with status 1.) ## Expected final lines of output `verify_1_starter.py`: ``` longest Collatz chain below 1000000: start 837799, 524 steps PASS ``` `verify_2_census.py`: ``` slowest start up to 1000000: 858341, 553 steps to reach a cycle cross-check: fast and slow methods agree for every start up to 20000 PASS ``` Before those lines the second script prints the three cycles (lengths 2, 5 and 18) and Table 1: | N | cycle of 1 | cycle of 5 | cycle of 17 | |---|---|---|---| | 10 | 6 (60.00%) | 4 (40.00%) | 0 (0.00%) | | 100 | 38 (38.00%) | 31 (31.00%) | 31 (31.00%) | | 1,000 | 349 (34.90%) | 306 (30.60%) | 345 (34.50%) | | 10,000 | 3244 (32.44%) | 3213 (32.13%) | 3543 (35.43%) | | 100,000 | 33030 (33.03%) | 32104 (32.10%) | 34866 (34.87%) | | 1,000,000 | 327679 (32.77%) | 323351 (32.34%) | 348970 (34.90%) | The output is the same on every run, because nothing in the scripts is random. ## Requirements - Python 3.9 or later. Tested on Python 3.9 and 3.13, with identical output. - The Python standard library only. Nothing to install. - No network access. On a laptop the first script takes under one second and the second about one second, using about 21 MB of memory. ## Files | File | What it is | | :--- | :--- | | `verify_1_starter.py` | Step 1. Reproduces the known answer to the starter problem: the longest Collatz chain below one million. Practice only. | | `verify_2_census.py` | Step 2. The census of the 3n-1 map, the slow cross-check, and the comparison with the numbers in the paper. | | `paper.tex` | The paper, in LaTeX. | | `paper.pdf` | The paper, ready to read. | | `refs.bib` | The three references, in BibTeX. | | `README.md` | This file. | ## Building the paper ``` pdflatex paper bibtex paper pdflatex paper pdflatex paper ``` ## Use of AI tools The paper and the code were drafted with an AI assistant (Claude) for certXiv. Every result was produced by running the scripts, and the three references were looked up on Crossref and arXiv to confirm that they exist. The assistant opened each one and checked the statements attributed to it. A fourth reference was removed because its text could not be opened. ## Licence Text (`paper.tex`, `paper.pdf`, `refs.bib`, `README.md`): CC BY 4.0. Code (`verify_1_starter.py`, `verify_2_census.py`): MIT.