back to table · edit · history · where entries came from · files · download
3493 bytes, as of the version from 2026-12-01 21:01 (current). Recorded here, not run.
"""T900: Erdős–Borwein sums in integer bases.
Requires numberdb and SageMath (or passagemath with real ball arithmetic).
sage -pip install numberdb
sage -python generate.py # verify all stored entries; no write
sage -python generate.py --publish # fill the assigned draft only
The parameter b is an integer >= 2; default enumeration is every b=2,...,64.
All positive exponents occur. With q=1/b, a finite sum through N has remainder
0 < R_N <= q^(N+1)/((1-q)*(1-q^(N+1))). This follows by bounding 1-q^n below
by 1-q^(N+1) for n>N, then summing a geometric series. The rational bound is
b/((b-1)*(b^(N+1)-1)). Exact integer powers and exact rational tail decisions
are used. Arb encloses finite-sum rounding; its union with [0,tail] encloses
the remainder. The tail is <= 10^(-digits-20)/(b-1), relative to the lower
bound B(b)>1/(b-1). The field uses numberdb.bits(digits, losing=96) bits.
Measured precisions and independent divisor-sieve checks are attached.
Definition and divisor identity: W. Zudilin, arXiv:1601.02688v2, Section 1,
equations (1) and (3). The bound above is elementary, derived here.
The executable checker is independent of this module.
Credentials and session attribution belong in the caller's environment.
"""
import argparse
import os
import sys
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
def enclosure(base, digits=100):
b = ZZ(base)
if b < 2 or str(b) != str(base):
raise ValueError('b must be an integer >= 2')
field = RealBallField(numberdb.bits(digits, losing=96))
target = QQ(1) / (ZZ(10)**(digits+20) * (b-1))
total = field(0)
power = ZZ(1)
n = 0
while True:
n += 1
power *= b
total += field(1) / (power-1)
tail = QQ(b) / ((b-1)*(power*b-1))
if tail <= target:
break
answer = total + field(0).union(field(tail))
if not answer.is_finite() or not answer.lower() > 0:
raise ArithmeticError('nonfinite or nonpositive enclosure')
if answer.accuracy() < numberdb.bits(digits, losing=16):
raise ArithmeticError('insufficient relative precision')
return answer, {'terms':n,'working_bits':int(field.prec()),
'relative_accuracy_bits':int(answer.accuracy()),
'tail_bound':str(tail),'native_type':type(answer).__name__}
class ErdosBorwein(numberdb.Generator):
table = 'T900'
parameters = ('b',)
type = 'R'
digits = 100
rigour = 'proven'
files = ('generate.py', 'check_values.py', 'argument-selection.md',
'numerical-evidence.json', 'skill-manifest.json', 'research.md')
def enumerate(self, maximum=64):
for b in range(2, maximum+1):
yield {'b':b}
def value(self, params, digits):
return enclosure(params['b'],digits)[0]
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--publish',action='store_true')
options=parser.parse_args()
if os.environ.get('NUMBERDB_KEY_FROM_STDIN') == '1':
numberdb.configure(api_key=sys.stdin.read().strip())
generator=ErdosBorwein()
if options.publish:
print(generator.publish(overwrite=False))
else:
report=generator.verify(sample=None)
print(report)
if not report.ok:
raise SystemExit(1)
if __name__=='__main__':
main()