back to table · edit · history · where entries came from · files · download
1823 bytes, as of the version from 2026-11-27 22:06 (current). Recorded here, not run.
"""Read-only local lookup demonstration over checked draft entry records.
Usage: python3 local_lookup.py stored-checkpoint.json lookup-local.json
Private draft values are not asserted to be public numeric-search results.
"""
import json,re,sys
from pathlib import Path
j=json.loads(Path(sys.argv[1]).read_text());records=j['records']
base='https://numberdb.org/p-adic_square_roots_of_squarefree_integers'
def lookup(p,u,n):
matches=[]
for r in records:
params=r['params']
if int(params['p'])!=p:continue
match=re.fullmatch(r'(\d+) \+ O\((\d+)\^(\d+)\)',r['number'])
value,pp,nn=map(int,match.groups())
if nn>=n and value%(p**n)==u%(p**n):
d=int(params['d']);matches.append({'table':j['table'],'params':params,'polynomial_id':'x^2-(%s)'%d,
'polynomial':'x^2-(%s)'%d,'definition_url':base,
'entry_url':base+'#'+','.join(params[k] for k in ('d','p','k','a'))})
return matches
transcript=[]
for r in records:
if r['params']['d']!='7' or r['params']['p']!='3':continue
u=int(r['number'].split(' + ')[0])
for n in [210,12]:
query={'prime':3,'residue':str(u%(3**n)),'precision':n}
matches=lookup(3,u,n)
assert any(m['params']==r['params'] for m in matches)
transcript.append({'query':query,'matches':matches,'expected_branch_found':True})
result={'scope':'local generated-record lookup of private draft; public values remain review-gated',
'polynomial_dictionary':{'x^2-(7)':{'definition':'f_d(x)=x^2-d at d=7','source':'https://kconrad.math.uconn.edu/blurbs/gradnumthy/hensel.pdf','locator':'Examples 1.1 and 2.2, Theorem 2.1','definition_url':base}},
'transcript':transcript}
Path(sys.argv[2]).write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2))