Read the checking program (47 lines of Python)
"""Check two nontrivial integer factors of the published Cunningham cofactor."""
import json
import sys
MAX_BYTES = 1024
COFACTOR = int(
"635461255568767457653876218974199286325456598542496565139544912352519122"
"468065011288702533160161244774874662269020956805058157486950157899782393"
"750600870993133511807815774334344280489692230690806000866497350528641454"
"524506269896810676523160199880666382682096397433281144393517329885569356"
"18125472798393786772032055019"
)
def verify(data, cofactor=COFACTOR):
tokens = data.split()
if len(tokens) != 2:
raise ValueError("Give exactly two decimal factors.")
if any(len(token) > len(str(cofactor)) or not token.isdigit() for token in tokens):
raise ValueError("Use unsigned decimal factors within the digit limit.")
left, right = map(int, tokens)
if not (1 < left < cofactor and 1 < right < cofactor):
raise ValueError("Both factors must be strictly between one and the cofactor.")
if left * right != cofactor:
raise ValueError("The product does not equal the challenge cofactor.")
return 0
def main():
data = sys.stdin.buffer.read(MAX_BYTES + 1)
try:
if len(data) > MAX_BYTES:
raise ValueError("The submission exceeds the byte limit.")
if not data.isascii() or any(c < 32 and c not in (9, 10, 13) for c in data):
raise ValueError("Use plain ASCII text.")
score = verify(data)
except ValueError as error:
result = {"valid": False, "score": None, "message": str(error)}
else:
result = {"valid": True, "score": score, "message": "The factors give a nontrivial split of the challenge cofactor."}
print(json.dumps(result))
if __name__ == "__main__":
main()