Created
October 30, 2024 12:36
-
-
Save gkucmierz/4834a788aa17aa82d074c656fe99d7c6 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
const M = (n, verbose = false) => { | |
const steps = n - 2; | |
const prime = 2n ** BigInt(n) - 1n; | |
verbose && console.log('prime: ', prime); | |
let s = 4n; | |
for (let i = 0; i < steps; ++i) { | |
s = (s ** 2n - 2n) % prime; | |
verbose && console.log(i, s); | |
} | |
return s === 0n; | |
}; | |
M(67, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment