Created
October 30, 2024 12:59
-
-
Save gkucmierz/646ca87052a73713b9a311e5d1de9b05 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
// https://projecteuler.net/problem=57 | |
const squareRoot = n => { | |
const STEPS = 100; | |
let res = 0; | |
for (let i = 0; i < STEPS; ++i) { | |
res = (n-1) / (2 + res); | |
} | |
return res + 1; | |
}; | |
for (let i = 0; i < 20; ++i) { | |
console.log(i, squareRoot(i), i ** 0.5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment