Computing the Ulam sequence to 7·10^13 with little memory
We computed the Ulam sequence up to 7·10^13: there are 5 178 547 339 755 Ulam numbers below 7·10^13. The previous published computations reached 10^12 (Gibbs and McCranie) and 10^13 (Álvarez Miguel). The program follows Gibbs's method. For λ≈2.4434, almost all terms n have {n/λ} in the middle third of the circle, and a number in the middle third can only be the sum of one of the few exceptional terms (the outliers) and another term. Unlike Knuth's implementation of the method, our program does not keep a table of all earlier numbers. It keeps only the outliers, a window of recent numbers and an archive of the terms near the two edges of the middle third. A lookup that these data cannot answer returns "unknown", and a number is declared a term or a non-term only by rules that are correct whatever the unknown values are; if no rule applies, the program stops. We prove that these rules are sound: if the program implements them correctly, its output is correct whenever it finishes, whatever fixed-point approximation of 1/λ it uses; the approximation changes which terms the program treats as outliers, and with it the work and memory required, and it can make the program stop, but it does not affect correctness. The output agrees with a full-memory computation to 2^34, with the counts of Gibbs and McCranie to 10^12, and with Álvarez Miguel's count below 10^13 and his 7 400 reported values U_k (k a multiple of 10^8). The counts beyond 10^13 come from a single run of our program and have not been checked independently.
Authors
- Shunsuke Funayama
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-23
- DOI
- https://doi.org/10.5281/zenodo.24475118
- Primary Topic
- Analytic Number Theory Research
- Type
- preprint