#!/usr/bin/env python3 """Job #1502 probe round 4: the adaptation that states Motohashi's principle. Round 3 found the modern adaptation: arXiv:2301.12669, "An induction principle for the Bombieri-Vinogradov theorem over F_q[t] and a variant of the Titchmarsh divisor problem". Its zbMATH review (round 1) says Motohashi proved that a Bombieri-Vinogradov type property of f and g is inherited by f*g. Round 4 reads its full HTML text (arXiv LaTeXML) and records every context in which it describes *how* that transfer works, plus the paper's own hypotheses. Read-only, public, no credentials. Raw reply saved + hashed in sources/. """ import hashlib import json import os import re import sys import urllib.error import urllib.request HERE = os.path.dirname(os.path.abspath(__file__)) OUT = os.path.join(HERE, "sources") os.makedirs(OUT, exist_ok=True) UA = {"User-Agent": "solveathome-local-probe/1 (research)", "Accept": "text/html"} AID = "2301.12669" def fetch(url): req = urllib.request.Request(url, headers=UA) try: with urllib.request.urlopen(req, timeout=45) as r: return r.status, r.read(), r.geturl() except urllib.error.HTTPError as e: return e.code, e.read(), url except Exception as e: return None, repr(e).encode(), url def plain(body): s = body.decode("utf-8", "replace") s = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?", " ", s) s = re.sub(r"(?s)<[^>]+>", " ", s) for a, b in (("'", "'"), (" ?", " "), ("&", "&")): s = re.sub(a, b, s) return re.sub(r"\s+", " ", s).strip() def main(): rec = {"round": 4, "arxiv_id": AID, "probes": [], "mentions": {}} for label, url in [("arxiv-html", "https://arxiv.org/html/%s" % AID), ("ar5iv", "https://ar5iv.labs.arxiv.org/html/%s" % AID), ("abs-page", "https://arxiv.org/abs/%s" % AID)]: status, body, final = fetch(url) with open(os.path.join(OUT, "r4-%s.html" % label), "wb") as f: f.write(body) p = {"label": label, "url": url, "status": status, "served_url": final, "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest()} txt = plain(body) p["text_bytes"] = len(txt) rec["probes"].append(p) for kw in ["Motohashi", "induction principle", "divisib", "dispersion", "convolut", "large sieve", "well-factorable", "Bombieri"]: n = len(re.findall(kw, txt, re.I)) if n: rec["mentions"].setdefault("counts", {}).setdefault(label, {})[kw] = n ctx = [] for m in re.finditer(r"Motohashi", txt): s = max(0, m.start() - 500) ctx.append(txt[s:m.start() + 700]) if ctx: rec["mentions"][label] = ctx[:12] # keep the abstract / intro head of the abs page if label == "abs-page": i = txt.find("Abstract") rec["abstract"] = txt[i:i + 1600] path = os.path.join(HERE, "job1502-sources-r4.json") with open(path, "w") as f: json.dump(rec, f, indent=1, sort_keys=True) print("wrote", path) for p in rec["probes"]: print("%-12s status=%s bytes=%s text=%s sha=%s" % (p["label"], p["status"], p["bytes"], p["text_bytes"], p["sha256"][:12])) print("counts:", json.dumps(rec["mentions"].get("counts", {}), sort_keys=True)) print("contexts:", {k: len(v) for k, v in rec["mentions"].items() if k != "counts"}) print("--- abstract ---") print(rec.get("abstract", "(none)")[:1200]) return 0 if __name__ == "__main__": sys.exit(main())