🧮 Recast Theorist: Prime Edge Graphical Proof
Explore the structural rhythm of primes using the original Recast Heuristic Model.
Adjust N to reveal how ΔB = 1 aligns with actual primes.
Select N (1–1000):
Generate
https://cdn.plot.ly/plotly-latest.min.js
function isPrime(n) {
if (n < 2) return false;
if (n === 2) return true;
if (n % 2 === 0) return false;
const r = Math.sqrt(n);
for (let i = 3; i <= r; i += 2) if (n % i === 0) return false;
return true;
}
function E(N) {
let s = 0;
for (let i = 1; i <= N; i++) s += (i – 1) % 2;
return s;
}
function B(N) { return N – E(N); }
function dB(N) { return N i + 1);
const Evals = Ns.map(E);
const Bvals = Ns.map(B);
const dBvals = Ns.map(dB);
const primes = Ns.filter(isPrime);
const primeEdges = Ns.filter(n => dB(n) === 1);
// Plot traces
const traceB = {x: Ns, y: Bvals, type: ‘scatter’, mode: ‘lines’, line: {color:’black’}, name: ‘B(N) = N – E(N)’};
const traceE = {x: Ns, y: Evals, type: ‘scatter’, mode: ‘lines’, line: {color:’gray’, dash:’dot’}, name: ‘E(N)’};
const tracePE = {x: primeEdges, y: primeEdges.map(n => Bvals[n-1]), mode: ‘markers’,
marker:{color:’red’, size:6}, name:’ΔB=1 (Prime Edge)’};
const traceLines = primes.map(p => ({
x:[p,p], y:[0, Math.max(…Bvals)],
type:’scatter’, mode:’lines’, line:{color:’blue’, width:1, opacity:0.2}, hoverinfo:’none’, showlegend:false
}));
const layout = {
title: `Recast Prime Edge Structure (N ≤ ${Nmax})`,
xaxis:{title:’N’},
yaxis:{title:’Branch Differential B(N)’},
showlegend:true, legend:{x:0.02, y:0.98},
margin:{l:60, r:20, t:50, b:40}
};
Plotly.newPlot(‘chart’, [traceB, traceE, tracePE, …traceLines], layout);
const N = Nmax;
const En = E(N), Bn = B(N), dBn = dB(N), detN = N – Math.abs(N – Math.abs(B(N) – B(N-1)) – B(N));
const primeEdge = (dBn === 1);
const truePrime = isPrime(N);
const nxt = nextPrime(N);
const gap = nxt – N;
document.getElementById(‘info’).innerHTML = `
🔹 Recast Prime Edge Analysis (N = ${N})
| E(N) | ${En} |
| B(N) = N – E(N) | ${Bn} |
| ΔB(N) | ${dBn} |
| det(N) | ${detN} |
| Heuristic Prime Edge? | ${primeEdge} |
| True Prime? | ${truePrime} |
| Next Prime | ${nxt} |
| Gap | ${gap} |
ΔB = 1 marks a structural prime edge — a minimal non-redundant addition
in the branch field. Blue lines mark numerical primes; red dots mark detected prime edges.
`;
}
// initial render
updateChart();