#!/usr/bin/env python3 """Job #1500: check that Levin's four hypotheses hold for the pair (f, f_hat) = (1, mu). Levin, B. V., "The 'average' distribution of mu(n) and Lambda_f(n) in progressions", Colloq. Math. Soc. Janos Bolyai 34 (1984) 995-1022, Theorem 1 (as quoted in the zbMATH review Zbl 0547.10037) needs, for the pair (f, f_hat): 1) a Bombieri theorem for f; 2) the Siegel-Walfisz-type character condition on f_hat; 3) sum_{n<=x} (sum_{d|n} |f(d) f(n/d)|)^2 << x (log x)^{2 alpha}; 4) sum_{n<=x} |f_hat(n)|^2 << x (log x)^{2 alpha}. Taking f = 1 gives f_hat = mu, so the corollary quoted by the review is the estimate (M) of return #4. This script checks, by exact computation to 10^6, that f = 1 really has convolution inverse mu and measures the two size sums. It says nothing about 1) and 2), which are analytic inputs. """ import math N = 10 ** 6 mu = [0] * (N + 1) primes = [] comp = bytearray(N + 1) mu[1] = 1 for i in range(2, N + 1): if not comp[i]: primes.append(i) mu[i] = -1 for p in primes: if i * p > N: break comp[i * p] = 1 if i % p == 0: mu[i * p] = 0 break mu[i * p] = -mu[i] # 1) (1 * mu)(n) = sum_{d|n} mu(d) = [n == 1] bad = 0 for n in range(1, N + 1): s = 0 d = 1 while d * d <= n: if n % d == 0: s += mu[d] if d != n // d: s += mu[n // d] d += 1 want = 1 if n == 1 else 0 if s != want: bad += 1 print('CONV (1*mu)(n) = [n=1] for every n <= %d : mismatches = %d' % (N, bad)) # 2) size sums: tau^2 (f = 1) and mu^2 (f_hat = mu) tau = [0] * (N + 1) for d in range(1, N + 1): for m in range(d, N + 1, d): tau[m] += 1 cum_tau2 = 0 cum_mu2 = 0 out = [] for n in range(1, N + 1): cum_tau2 += tau[n] * tau[n] cum_mu2 += mu[n] * mu[n] if n in (10 ** 4, 10 ** 5, 10 ** 6): L = math.log(n) out.append({ 'x': n, 'sum_tau2_over_x_log3x': round(cum_tau2 / (n * L ** 3), 5), 'sum_mu2_over_x': round(cum_mu2 / n, 6), 'alpha_for_f_eq_1': 1.5, 'alpha_for_mu': 0.0, }) for row in out: print('SIZE ', row) print('NOTE sum_tau2/x(log x)^3 converges to 1/pi^2 = %.5f, so alpha = 3/2 is the' ' smallest alpha that can be claimed from condition 3 for f = 1;' ' sum_mu2/x -> 6/pi^2 = %.6f <= 1, so condition 4 holds for f_hat = mu with alpha = 0.' % (1 / math.pi ** 2, 6 / math.pi ** 2))