This repository will gather several methods for computing to arbitrary precision the block-Irwin sums
where
References:
- J.-F. Burnol, Block-count constrained harmonic sums: spectral expansion and block-directed Euler–Maclaurin, arXiv:2609.17045.
- J.-F. Burnol, The modal expansion of Kempner sums, arXiv:2609.31986.
Methods:
- Script
blockirwin.py— full documentation: README-method1.md. Proposition 11 of arXiv:2609.17045 expresses$I(b,w,k)$ through Stieltjes values of the measures$\eta_j$ , Proposition 12 (level raising) pushes their arguments to at least$\ell$ digits, and these values are computed as alternating series in the moments of the$\eta_j$ , obtained from the finite triangular recurrences of Proposition 13. Any base, any block, any$k\ge0$ . - Script
modalirwin.py- full documentation: README-modalirwin.md. Implements the spectral/modal series of arXiv:2609.17045, Part 2 ($k\ge1$ ), and the modal Kempner series of arXiv:2609.31986 ($k=0$ ). It uses the published triangular recurrences for the moments of$\eta_0$ ,$\mu_0$ , and the tilted measures$\nu_j$ , and the corresponding modal coefficients, with level-raised Newton series for the auxiliary Stieltjes integrals. - Uncertain, may never be done: modal expansions applied once a certain level has been reached.
Performance and dependence on k. blockirwin.py (method 1)
becomes more costly as k grows. In contrast,
modalirwin.py becomes faster with increasing k.
For example, at b=10, w="314", 40 digits (best of three runs,
October 12, 2026, CPython 3.13.16, mpmath 1.4.1),
calls to blockirwin.py took 0.026 s (k=1) versus 0.039 s
(k=10), while modalirwin.py 0.6.0 took 0.305 s versus 0.0071 s.
Of course timings are heavily hardware dependent.
This is an illustration, not a universal ordering: method 1 often wins
(by orders of magnitude). For details about the heuristically estimated
cubic cost in the number of modes see
README-modalirwin.md.
from blockirwin import blockirwin
from modalirwin import modalirwin
print(blockirwin(2, "01", 0, 20))
print(modalirwin(2, "01", 0, 20))
modalirwin(2, "01", 2, 20, modalcoeffs=True)python compare_modalirwin.py 2 01 0 20
python -m pytest -q test_blockirwin.py test_modalirwin.py test_modalirwin_cancellation.pyThe modules use Python's standard library and mpmath.
See some comments about mpmath version at bottom of README-method1.md.
The initial blockirwin.py, test_blockirwin.py, README-method1.md,
and this README.md's original version were produced on September 28–29, 2026
by Claude Opus 5.5 and Claude Sonnet 5 (Anthropic), from the mathematics
and earlier Maple/SageMath/mpmath code of Jean-François Burnol.
The complementary modalirwin.py, and other files inclusive of
test_modalirwin.py and compare_modalirwin.py were produced with OpenAI
ChatGPT (GPT-6) on October 10-11, 2026, from the two Burnol preprints.
This README.md was extended by ChatGPT (GPT-6) to cover this, and then
edited (twice: on October 10 and again on October 11) by a human, to prune
some too lengthy (and too heavily decorated like this) ChatGPT outputs.
On October 12, 2026, Claude Opus 5.5 (Anthropic) made test_blockirwin.py
run fully under current pytest, and revised the ChatGPT modalirwin.py
into version 0.6.0: exact integer level raising built once per call,
removal of a defect which forced full precision in all modes, and new
default levels; one test of test_modalirwin.py and
README-modalirwin.md were adapted accordingly.
The mathematics is fully authored by Jean-François Burnol. It was parsed by ChatGPT 5.6 Sol to search for errors (and improve the English language use).
The repository is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.