Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created October 30, 2024 12:36
Show Gist options
  • Save gkucmierz/4834a788aa17aa82d074c656fe99d7c6 to your computer and use it in GitHub Desktop.
Save gkucmierz/4834a788aa17aa82d074c656fe99d7c6 to your computer and use it in GitHub Desktop.
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