Skip to content

Export expanded-case factor metadata in hardness runs#23

Merged
GISMO-1 merged 1 commit into
mainfrom
gismo/add-jsonl-export-for-expanded-case-metadata
Mar 2, 2026
Merged

Export expanded-case factor metadata in hardness runs#23
GISMO-1 merged 1 commit into
mainfrom
gismo/add-jsonl-export-for-expanded-case-metadata

Conversation

@GISMO-1

@GISMO-1 GISMO-1 commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Attach structural tags (residue, SPF/cofactor, semiprime kind) to expanded cases at source so large-range hardness runs can collect classification data without separate profiling scans.
  • The SPF search must be bounded to keep per-case work predictable and to scale to huge ranges.
  • Keep factoring/primality logic reusable and deterministic and avoid changing existing expanded export behavior when the new option is not supplied.

Description

  • Add a new CLI option --export-expanded-meta PATH and a bound option --expanded-factor-bound INT (default 20000) to the strausforge hardness command and wire them through to run_hardness in hardness_core.py.
  • Introduce a new reusable module src/strausforge/factor_meta.py with smallest_prime_factor_bounded, a trial-division primality helper, semiprime_kind_from_spf, and write_jsonl_record to keep factoring helpers separate from CLI logic.
  • Extend run_hardness to optionally emit a second JSONL stream (one object per expanded case, deterministic ordering by increasing n) containing the fields n, res48, identity, t_used, window_used, proc_heuristic, spf, cofactor, and semiprime_kind, with SPF search capped by min(expanded_factor_bound, isqrt(n)) and spf == 0 when no factor is found within the bound.
  • Update README.md and CLI examples to document --export-expanded-meta and --expanded-factor-bound and note the intended research purpose.
  • Add unit tests in tests/test_factor_meta.py covering smallest_prime_factor_bounded, semiprime classification (p*q and p^2), the JSONL writer producing one object per line, and that the expanded-meta JSONL is emitted in sorted/evaluation order and matches the expected schema.

Testing

  • Installed dev dependencies via python -m pip install -e '.[dev]' which completed successfully.
  • Ran targeted tests with pytest -q tests/test_factor_meta.py tests/test_hardness_core.py tests/test_cli.py which passed (targeted run completed successfully).
  • Ran the full test suite with pytest -q and observed all tests passing (68 passed, 1 skipped).

Codex Task

@GISMO-1 GISMO-1 merged commit 69e4bf3 into main Mar 2, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant