#!/usr/bin/env python3 """job1650 arXiv API sweep: is there a *shift-aware* or *max-inside* level of distribution at Q >= x^(13/25)? Control query included; a zero-entry answer is a channel outcome, never evidence of absence. Network metadata only (0 CPU-h compute). Raw XML is kept per query; stdout is the deterministic summary.""" import json import pathlib import urllib.parse import urllib.request import xml.etree.ElementTree as ET OUT = pathlib.Path(__file__).resolve().parent # no machine-specific path in the artifact NS = {"a": "http://www.w3.org/2005/Atom"} QUERIES = [ ("control", 'all:"twin primes"'), ("level-max-inside", 'all:"level of distribution" AND all:"maximal"'), ("shifted-conv-kloosterman", 'abs:"shifted convolution" AND abs:"Kloosterman fractions"'), ("mobius-unbalanced", 'abs:"level of distribution" AND abs:"unbalanced"'), ("bettin-chandee", 'all:"Bettin-Chandee"'), ("granville-shao", 'all:"Granville-Shao"'), ] rows = [] for tag, q in QUERIES: url = ("http://export.arxiv.org/api/query?search_query=" + urllib.parse.quote(q) + "&start=0&max_results=8") try: with urllib.request.urlopen(url, timeout=40) as fh: raw = fh.read().decode("utf-8", "replace") except Exception as exc: # channel failure is recorded, never treated as absence rows.append({"tag": tag, "query": q, "channel": "ERROR", "detail": str(exc), "n": None}) continue (OUT / f"arxiv-{tag}.xml").write_text(raw, encoding="utf-8") root = ET.fromstring(raw) entries = root.findall("a:entry", NS) recs = [] for e in entries: recs.append({ "id": (e.findtext("a:id", "", NS) or "").strip(), "title": " ".join((e.findtext("a:title", "", NS) or "").split()), }) rows.append({"tag": tag, "query": q, "channel": "OK", "n": len(entries), "records": recs}) (OUT / "job1650-sweep.json").write_text(json.dumps(rows, indent=1) + "\n", encoding="utf-8") for r in rows: print(f"[{r['tag']}] channel={r['channel']} n={r['n']}") if r.get("records"): for rec in r["records"]: print(" ", rec["id"].split("/abs/")[-1], "|", rec["title"][:110]) print("CONTROL_ALIVE", rows[0]["channel"] == "OK" and (rows[0]["n"] or 0) > 0)