Below, the computer brute-forces small bases (2 to 20) and exponents (3 to 6) looking for triples where Ax+By=Cz. Press Search and watch every equality it finds — then check the greatest common factor column.
<p class="hint">Enter positive integer bases A, B and exponents x, y (both above 2) and check whether A^x + B^y lands exactly on some C^z. Or press Search to brute-force many small triples at once.</p>
<div class="inputs">
<label>A <input id="A" type="number" min="2" max="20" value="3"></label>
<label>x <input id="X" type="number" min="3" max="8" value="3"></label>
<label>B <input id="B" type="number" min="2" max="20" value="6"></label>
<label>y <input id="Y" type="number" min="3" max="8" value="3"></label>
</div>
<div class="btns">
<button id="check" type="button">Check this pair</button>
<button id="search" type="button">Search for equalities</button>
<button id="reset" type="button" class="ghost">Clear</button>
</div>
<div class="status" id="status">Enter A, B, x, y and press Check, or press Search.</div>
<table class="results" id="results">
<thead>
<tr><th>Equality found</th><th>gcd(A,B,C)</th></tr>
</thead>
<tbody id="resultsBody"></tbody>
</table>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.hint { font-size: .9rem; color: #444; margin: 0 0 .7rem; line-height: 1.45; }
.inputs { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.inputs label { font-size: .85rem; font-weight: 600; color: #1d3557; display: flex; flex-direction: column; gap: .2rem; }
.inputs input { width: 64px; font: 600 14px ui-monospace, monospace; padding: .3rem .4rem;
border: 1px solid #adb1b8; border-radius: 6px; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
.status { font-size: 1rem; font-weight: 600; margin: .4rem 0 .7rem; min-height: 1.4em; }
.status.ok { color: #0a7d33; }
.status.bad { color: #c92f3c; }
table.results { border-collapse: collapse; width: 100%; font: 13px ui-monospace, monospace; }
table.results th, table.results td { border: 1px solid #cdd9e3; padding: .35rem .5rem; text-align: left; }
table.results th { background: #e8eef3; color: #1d3557; }
table.results td.gcd { font-weight: 700; color: #0a7d33; }
const i18nFmt = (s, v) => s.replace(/%(\w+)%/g, (_, k) => String(v[k] ?? ''));
// Beal conjecture: if A^x + B^y = C^z with x, y, z all > 2, the conjecture
// says A, B, C must share a common prime factor. Bounds are kept small so the browser can search instantly.
const MAXBASE = 12, MINEXP = 3, MAXEXP = 5;
function gcd(a, b) { while (b) { [a, b] = [b, a % b]; } return a; }
// Greatest common divisor of three integers, via two pairwise gcd calls.
function gcd3(a, b, c) { return gcd(gcd(a, b), c); }
function setStatus(t, cls) {
const s = document.getElementById('status');
s.textContent = t; s.className = 'status ' + cls;
}
function addRow(A, x, B, y, C, z, g) {
const tb = document.getElementById('resultsBody');
const tr = document.createElement('tr');
const eq = document.createElement('td');
eq.textContent = `${A}^${x} + ${B}^${y} = ${C}^${z}`;
const gc = document.createElement('td');
gc.textContent = g;
gc.className = 'gcd';
tr.appendChild(eq); tr.appendChild(gc);
tb.appendChild(tr);
}
// Check whether the single typed-in pair (A^x, B^y) sums to a perfect z-th power for some small z.
function checkOne() {
const A = parseInt(document.getElementById('A').value, 10);
const X = parseInt(document.getElementById('X').value, 10);
const B = parseInt(document.getElementById('B').value, 10);
const Y = parseInt(document.getElementById('Y').value, 10);
if (!A || !B || X < 3 || Y < 3) { setStatus('Enter valid integers with exponents of 3 or more.', 'bad'); return; }
const sum = Math.pow(A, X) + Math.pow(B, Y);
// Try each exponent z and round-trip check whether the sum is a perfect z-th power.
for (let z = MINEXP; z <= 8; z++) {
const C = Math.round(Math.pow(sum, 1 / z));
for (const cc of [C - 1, C, C + 1]) {
if (cc >= 2 && Math.pow(cc, z) === sum) {
const g = gcd3(A, B, cc);
document.getElementById('resultsBody').innerHTML = '';
addRow(A, X, B, Y, cc, z, g);
setStatus(i18nFmt('Found a match — gcd(A,B,C) = %g% (never 1).', { g: g }), 'ok');
return;
}
}
}
setStatus('No integer C makes A^x + B^y a perfect power in this range.', 'bad');
}
// Brute-force small A, B in [2,12] and exponents in [3,5], collecting every equality found.
function search() {
document.getElementById('resultsBody').innerHTML = '';
setStatus('Searching small triples…', '');
let checked = 0, found = 0, anyCoprime = false;
outer:
for (let A = 2; A <= MAXBASE; A++) {
for (let x = MINEXP; x <= MAXEXP; x++) {
const Ax = Math.pow(A, x);
for (let B = A; B <= MAXBASE; B++) {
for (let y = MINEXP; y <= MAXEXP; y++) {
const By = Math.pow(B, y);
const sum = Ax + By;
for (let z = MINEXP; z <= MAXEXP; z++) {
checked++;
const C = Math.round(Math.pow(sum, 1 / z));
if (C >= 2 && Math.pow(C, z) === sum) {
const g = gcd3(A, B, C);
if (g === 1) anyCoprime = true;
addRow(A, x, B, y, C, z, g);
found++;
if (found >= 12) break outer;
}
}
}
}
}
}
if (anyCoprime) setStatus('Coprime counterexample found! (This would disprove the conjecture — check your numbers.)', 'bad');
else setStatus(i18nFmt('Found %n% equalities after checking %k% combinations — every single one shares a common factor.', { n: found, k: checked }), 'ok');
}
document.getElementById('check').addEventListener('click', checkOne);
document.getElementById('search').addEventListener('click', search);
document.getElementById('reset').addEventListener('click', () => {
document.getElementById('resultsBody').innerHTML = '';
setStatus('Enter A, B, x, y and press Check, or press Search.', '');
});
<p class="hint">Enter positive integer bases A, B and exponents x, y (both above 2) and check whether A^x + B^y lands exactly on some C^z. Or press Search to brute-force many small triples at once.</p>
<div class="inputs">
<label>A <input id="A" type="number" min="2" max="20" value="3"></label>
<label>x <input id="X" type="number" min="3" max="8" value="3"></label>
<label>B <input id="B" type="number" min="2" max="20" value="6"></label>
<label>y <input id="Y" type="number" min="3" max="8" value="3"></label>
</div>
<div class="btns">
<button id="check" type="button">Check this pair</button>
<button id="search" type="button">Search for equalities</button>
<button id="reset" type="button" class="ghost">Clear</button>
</div>
<div class="status" id="status">Enter A, B, x, y and press Check, or press Search.</div>
<table class="results" id="results">
<thead>
<tr><th>Equality found</th><th>gcd(A,B,C)</th></tr>
</thead>
<tbody id="resultsBody"></tbody>
</table>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.hint { font-size: .9rem; color: #444; margin: 0 0 .7rem; line-height: 1.45; }
.inputs { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.inputs label { font-size: .85rem; font-weight: 600; color: #1d3557; display: flex; flex-direction: column; gap: .2rem; }
.inputs input { width: 64px; font: 600 14px ui-monospace, monospace; padding: .3rem .4rem;
border: 1px solid #adb1b8; border-radius: 6px; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
.status { font-size: 1rem; font-weight: 600; margin: .4rem 0 .7rem; min-height: 1.4em; }
.status.ok { color: #0a7d33; }
.status.bad { color: #c92f3c; }
table.results { border-collapse: collapse; width: 100%; font: 13px ui-monospace, monospace; }
table.results th, table.results td { border: 1px solid #cdd9e3; padding: .35rem .5rem; text-align: left; }
table.results th { background: #e8eef3; color: #1d3557; }
table.results td.gcd { font-weight: 700; color: #0a7d33; }
const i18nFmt = (s, v) => s.replace(/%(\w+)%/g, (_, k) => String(v[k] ?? ''));
// Beal conjecture: if A^x + B^y = C^z with x, y, z all > 2, the conjecture
// says A, B, C must share a common prime factor. Bounds are kept small so the browser can search instantly.
const MAXBASE = 12, MINEXP = 3, MAXEXP = 5;
function gcd(a, b) { while (b) { [a, b] = [b, a % b]; } return a; }
// Greatest common divisor of three integers, via two pairwise gcd calls.
function gcd3(a, b, c) { return gcd(gcd(a, b), c); }
function setStatus(t, cls) {
const s = document.getElementById('status');
s.textContent = t; s.className = 'status ' + cls;
}
function addRow(A, x, B, y, C, z, g) {
const tb = document.getElementById('resultsBody');
const tr = document.createElement('tr');
const eq = document.createElement('td');
eq.textContent = `${A}^${x} + ${B}^${y} = ${C}^${z}`;
const gc = document.createElement('td');
gc.textContent = g;
gc.className = 'gcd';
tr.appendChild(eq); tr.appendChild(gc);
tb.appendChild(tr);
}
// Check whether the single typed-in pair (A^x, B^y) sums to a perfect z-th power for some small z.
function checkOne() {
const A = parseInt(document.getElementById('A').value, 10);
const X = parseInt(document.getElementById('X').value, 10);
const B = parseInt(document.getElementById('B').value, 10);
const Y = parseInt(document.getElementById('Y').value, 10);
if (!A || !B || X < 3 || Y < 3) { setStatus('Enter valid integers with exponents of 3 or more.', 'bad'); return; }
const sum = Math.pow(A, X) + Math.pow(B, Y);
// Try each exponent z and round-trip check whether the sum is a perfect z-th power.
for (let z = MINEXP; z <= 8; z++) {
const C = Math.round(Math.pow(sum, 1 / z));
for (const cc of [C - 1, C, C + 1]) {
if (cc >= 2 && Math.pow(cc, z) === sum) {
const g = gcd3(A, B, cc);
document.getElementById('resultsBody').innerHTML = '';
addRow(A, X, B, Y, cc, z, g);
setStatus(i18nFmt('Found a match — gcd(A,B,C) = %g% (never 1).', { g: g }), 'ok');
return;
}
}
}
setStatus('No integer C makes A^x + B^y a perfect power in this range.', 'bad');
}
// Brute-force small A, B in [2,12] and exponents in [3,5], collecting every equality found.
function search() {
document.getElementById('resultsBody').innerHTML = '';
setStatus('Searching small triples…', '');
let checked = 0, found = 0, anyCoprime = false;
outer:
for (let A = 2; A <= MAXBASE; A++) {
for (let x = MINEXP; x <= MAXEXP; x++) {
const Ax = Math.pow(A, x);
for (let B = A; B <= MAXBASE; B++) {
for (let y = MINEXP; y <= MAXEXP; y++) {
const By = Math.pow(B, y);
const sum = Ax + By;
for (let z = MINEXP; z <= MAXEXP; z++) {
checked++;
const C = Math.round(Math.pow(sum, 1 / z));
if (C >= 2 && Math.pow(C, z) === sum) {
const g = gcd3(A, B, C);
if (g === 1) anyCoprime = true;
addRow(A, x, B, y, C, z, g);
found++;
if (found >= 12) break outer;
}
}
}
}
}
}
if (anyCoprime) setStatus('Coprime counterexample found! (This would disprove the conjecture — check your numbers.)', 'bad');
else setStatus(i18nFmt('Found %n% equalities after checking %k% combinations — every single one shares a common factor.', { n: found, k: checked }), 'ok');
}
document.getElementById('check').addEventListener('click', checkOne);
document.getElementById('search').addEventListener('click', search);
document.getElementById('reset').addEventListener('click', () => {
document.getElementById('resultsBody').innerHTML = '';
setStatus('Enter A, B, x, y and press Check, or press Search.', '');
});
Comments
Loading comments...