Purpose of Day 04
An independent re-implementation in a second language (Python) of the verification methodology documented on Day 03. The goal is to confirm that the inductive first-descent procedure is free of language-specific artefacts. All results are labelled. No claim is made that the Collatz conjecture is solved.
1. Scope of the Independent Check
Hesaplandı A pure-Python implementation of the algorithm of Day 03 was written and executed for the reduced bound \(B=2^{20}\). Every integer \(2\le n<2^{20}\) was confirmed to satisfy \(\sigma(n)<\infty\).
Bilinen literatür The same inductive principle and residue-class reduction appear in the classical verification literature (Terras 1976; subsequent large-scale projects).
The full \(2^{36}\) bound remains the result of the original C implementation (Day 03). The Python run serves as an independent audit of the algorithm and of the short-orbit reductions; scaling the Python code to \(2^{36}\) is an engineering exercise, not a change in the mathematical procedure.
2. Python Implementation
Python reference implementation (exact integer arithmetic)
def T(n: int) -> int:
"""Accelerated Terras map."""
if n & 1:
return (3 * n + 1) >> 1
return n >> 1
def sigma_finite(n: int, max_steps: int = 10_000) -> bool:
"""Return True if T^k(n) < n for some k ≤ max_steps."""
m = n
for _ in range(max_steps):
m = T(m)
if m < n:
return True
return False
def verify_up_to(B: int) -> bool:
"""Inductive first-descent check for all n < B."""
for n in range(2, B):
if (n & 1) == 0 or (n & 3) == 1:
continue # σ(n) ≤ 2, proved
# n ≡ 3 (mod 4)
if not sigma_finite(n):
return False
return True
# Independent confirmation
assert verify_up_to(1 << 20) # 2^20
Hesaplandı The function verify_up_to(1 << 20) returns True. Execution used only Python’s native arbitrary-precision integers; no external libraries were required.
Kanıtlandı The residue-class short-circuits (even and ≡ 1 mod 4) are identical to those proved on Day 03 and do not depend on the programming language.
3. Correctness of the Python Translation
- Kanıtlandı. The map
Timplements exactly the accelerated map defined on Day 02. - Kanıtlandı. The early-exit conditions for even and ≡ 1 (mod 4) integers reproduce the short explicit orbits of Day 03, Section 2.
- Hesaplandı. For every remaining integer below \(2^{20}\) the loop terminates with a strictly smaller value. This is a finite machine computation performed in a second language.
- Kanıtlandı. By the inductive principle of Day 03, Section 1, the result implies finite stopping time for all integers less than the tested bound.
Independent confirmation · Hesaplandı
Every integer \(2\le n<2^{20}\) has finite stopping time under \(T\). The algorithm and the short-orbit reductions are language-independent.
4. Comparison with the Original C Implementation
| Aspect | C (Day 03) | Python (Day 04) | Label |
|---|---|---|---|
| Bound | \(2^{36}\) | \(2^{20}\) (audit) | Hesaplandı |
| Arithmetic | 64-bit fixed | Arbitrary-precision | Kanıtlandı |
| Block tables | Yes (r ≈ 16–20) | Omitted (small bound) | Hesaplandı |
| Result | All n < 2^{36} descend | All n < 2^{20} descend | Hesaplandı |
Varsayım/Sezgi Adding the same modular block tables to the Python code would recover the performance characteristics of the C implementation; the mathematical content is unchanged.
5. Reproducibility Package
- The complete Python script appears in the algorithm box above and can be saved as
verify_py.py. - Invocation:
python3 verify_py.py(assertion must pass). - No external dependencies.
- Identical logic can be transcribed to any language supporting exact integer division.
Hesaplandı The reduced-bound confirmation is reproducible on any standard Python 3 interpreter.
6. Limitations and Open Status
Bilinen literatür Larger independent verifications exist in the literature (Barina et al. to \(2^{71}\)); the present exercise is an internal consistency audit of this project’s methodology.