back to table · edit · history · where entries came from · files · download
1532 bytes, as of the version from 2026-12-02 03:19 (current). Recorded here, not run.
"""Read-only full verification of T908; the private API key is read from stdin."""
import hashlib
import json
import sys
import numberdb.sage as numberdb
from generate import GelfondConstant
import check_math
key = sys.stdin.read().strip()
if '=' in key and key.split('=',1)[0].isupper():
key=key.split('=',1)[1].strip().strip('\"\'')
client = numberdb.Client(api_key=key, as_sage=True)
generator = GelfondConstant()
document = numberdb.table(generator.table, client=client)
assert document['Parameters']=={} and len(document['Numbers'])==1
stored = document['Numbers'][0]
assert type(stored) is str
math_result = check_math.report(stored)
reproduction = generator.verify(sample=None, client=client)
assert reproduction.ok and reproduction.checked==1 and reproduction.matched==1
assert not reproduction.differing and not reproduction.missing and not reproduction.extra
result = {'table': generator.table, 'stored_decimal': stored, 'parameters': {},
'checked_entries': 1, 'total_entries': 1, 'failures': [],
'generator_verify': {'checked': int(reproduction.checked), 'matched': int(reproduction.matched), 'ok': bool(reproduction.ok)},
'independent_check': math_result,
'known_answer_control': math_result['known_answer_control'],
'negative_control_rejected': math_result['negative_control_rejected'],
'document_sha256_sorted_json': hashlib.sha256(json.dumps(document, sort_keys=True, ensure_ascii=False).encode()).hexdigest()}
print('RESULT_JSON='+json.dumps(result))