back to table · edit · history · where entries came from · files · download
870 bytes, as of the version from 2026-12-01 10:12 (current). Recorded here, not run.
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_mpfi import RealIntervalField
from sage.sets.primes import Primes
def copeland_erdos(b, digits=100):
# Construct and read the prime blocks in the same integer radix b >= 2.
b = int(b)
if b < 2:
raise ValueError("b must be at least 2")
total, length = QQ(0), 0
for p in Primes():
q, width = int(p), 0
while q:
q //= b
width += 1
length += width
total += QQ(p) / b**length
if b**length > 10**(digits+15):
bits = max(512, numberdb.bits(digits, losing=100))
return RealIntervalField(bits)(total, total + QQ(1)/b**length)
values = {b: copeland_erdos(b) for b in range(2, 17)}
# The function also evaluates other construction radices, such as copeland_erdos(17).