# Cheapest decisive check for a candidate route to the fixed-shift de-averaging problem: # does the Liouville component of mu cancel against Lambda(n-2)? # Identity used: mu(n)*lambda(n) = 1_{n squarefree} (since mu(n)=lambda(n)*1_{sqfree}) # so Sigma_{n<=x} Lambda(n-2)*mu(n)*lambda(n) = Sigma_{n<=x, n squarefree} Lambda(n-2). N = 2_000_000 sieve = bytearray([1])*(N+1) sieve[0:2] = b'\x00\x00' i = 2 while i*i <= N: if sieve[i]: sieve[i*i::i] = bytearray(len(range(i*i, N+1, i))) i += 1 # smallest prime factor for Lambda(n-2) import math spf = [0]*(N+1) for p in range(2, N+1): if sieve[p]: for m in range(p, N+1, p): if spf[m] == 0: spf[m] = p # squarefree up to N sqfree = [True]*(N+1) sqfree[0] = False p = 2 while p*p <= N: if sieve[p]: pp = p*p for m in range(pp, N+1, pp): sqfree[m] = False p += 1 tot = 0.0 sqf = 0.0 for n in range(4, N+1): m = n-2 if m < 2 or not sieve[m]: continue # Lambda(m) for prime m = log m tot += math.log(m) if sqfree[n]: sqf += math.log(m) print(f"x={N}") print(f" A(x) = Sigma Lambda(n-2) = {tot:.1f} (A/x = {tot/N:.4f})") print(f" B(x) = Sigma_{{n sqfree}} Lambda(n-2) = {sqf:.1f} (B/x = {sqf/N:.4f})") print(f" B/A = {sqf/tot:.6f} (6/pi^2 = {6/math.pi**2:.6f})") # elementary law for the projected-diagonal density rho = 1.0 for p in range(3, 200000, 2): if sieve[p]: rho *= (1 - 1.0/(p*(p-1))) print(f" rho = prod_{{p odd}} (1 - 1/(p(p-1))) = {rho:.6f} (naive 6/pi^2 = {6/math.pi**2:.6f})")