Created
May 10, 2023 15:01
-
-
Save gkucmierz/b5db360aa8401e231ce48dda32d5c0c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Eulers bricks (brute force) | |
const check = (a, b, c) => { | |
if (Math.hypot(a, b) % 1 !== 0) return false; | |
if (Math.hypot(b, c) % 1 !== 0) return false; | |
if (Math.hypot(c, a) % 1 !== 0) return false; | |
return Math.hypot(a, b, c); | |
} | |
const MAX = 1e3; | |
for (let a = 1; a < MAX; ++a) { | |
for (let b = 1; b < MAX; ++b) { | |
for (let c = 1; c < MAX; ++c) { | |
const res = check(a, b, c); | |
if (res !== false) { | |
console.log(a, b, c, res); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment