Last active
August 23, 2024 14:47
-
-
Save Hoyasumii/59fc24bd7693bdeb155034a3183c3c9e to your computer and use it in GitHub Desktop.
Factorial Alghoritm for JavaScript
This file contains hidden or 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 factorial = (number) => { | |
if (number <= 1) return 1; | |
return BigInt(number) * BigInt(factorial(number - 1)); | |
} | |
console.time("res"); | |
console.log(factorial(31_931)) | |
console.timeEnd("res"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment