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
R = RealBallField(numberdb.bits(100, losing=64))
def K(r):
r = ZZ(r)
if r < 0:
raise ValueError('Require r >= 0')
if r == 0:
return ZZ(1)
s = r + 1
if r % 2:
return 4/R.pi() * (1-R(2)**(-s)) * R(s).zeta()
return (4/R.pi() * R(4)**(-s)
* (R(s).zeta(R(QQ(1)/4))-R(s).zeta(R(QQ(3)/4))))
print(K(4))
For odd $r$, the defining sum is evaluated as $(1-2^{-r-1})\zeta(r+1)$ using the Riemann zeta function. For even $r\geq2$, it is evaluated as $4^{-r-1}(\zeta(r+1,1/4)-\zeta(r+1,3/4))$ using the Hurwitz zeta function. Multiplication by $4/\pi$ gives $K_r$. All operations use Arb balls at 397 bits, comprising the requested 100 significant digits and 64 guard bits. The largest computed radius is less than $1.9\times10^{-119}$. The value $K_0=1$ is stored exactly.
Independent checks construct the exact integers $A_r$ by the Entringer recurrence, control that recurrence by explicitly enumerating alternating permutations through order eight, and compare all 21 counts with [5]. Rational coefficients from $\sec(x/2)+\tan(x/2)$ and the stored Euler polynomials give the same coefficients. At 600 bits these independent values lie inside every displayed decimal interval. The attached checks also test the parity inequalities and all 190 relations with the Landau–Kolmogorov constants, and repeat the interval tests on values read back from the database.