Big Factorial (BigInt)
Compute n! up to 1000 with BigInt and show full result + digit count.
Large factorials with BigInt
Factorials blow up fast. By 13! you've already cleared 2³² (Int32 overflow), and 21! sails past 2⁶⁴ (Int64 overflow). The catch in JavaScript is that the Number type is a 64-bit float, which stops being exact once you go above Number.MAX_SAFE_INTEGER = 2⁵³ − 1. That's what BigInt solves. It's been part of the language since ES2020 and gives you arbitrary-precision integers, written with an n suffix (10n). Computing the value is nothing fancy — a loop over a BigInt accumulator: let r = 1n; for (let i = 2n; i <= BigInt(n); i++) r *= i;. If you just want a sense of the size, Stirling's approximation does the job: n! ≈ √(2πn)·(n/e)ⁿ. To put numbers on it, 100! runs to 158 digits and 1000! to 2,568.
Applications and context
You'll run into this in cryptography, where RSA does modular arithmetic on enormous integers, and in theoretical combinatorics, where a brute-force TSP is O(n!). It also shows up in combinatorial analysis in ML when you're counting permutations of features, in large counters backed by BigInt columns in databases, and across competitive programming — plenty of Codeforces and Project Euler problems have answers that simply won't fit in 64 bits.
FAQ
Why not use Number for large factorials? Once you pass 2⁵³ the results get rounded, so the trailing digits come out wrong. BigInt keeps every digit exact.
How slow is BigInt? Multiplying an N-digit number costs O(N), or O(N log N) on engines that fall back to FFT. In practice, modern V8 computes 1000! in a few milliseconds.
Can I mix BigInt with Number? No. JavaScript throws a TypeError if you try. You have to convert first, with BigInt(x) or Number(b).
Related Tools
Combinations & Permutations
Calculate combinations C(n,k) and permutations P(n,k) with formulas and results for large numbers. Essential for combinatorics.
Factorial Calculator
Compute n! (factorial) for any integer up to 170 (double precision limit). Above that, returns exact BigInt. Useful for combinatorics, probability and discrete math. Everything in your browser.
Large Factorial Calculator
Calculate the factorial of large numbers (n!) with arbitrary precision using BigInt, with no lost digits. Ideal for combinatorics and probability.
Arrangements A(n,k)
Compute arrangements A(n,k) (same as permutations).
Bond Yield (Coupon)
Estimates approximate yield-to-maturity of a coupon bond from face, price, and term.
Bearing Speed Factor
Calculate a bearing's speed factor, A = n·d_m, from the rotation n (rpm) and the bearing mean diameter d_m (mm, = (D + d)/2, the average of outer and inner diameters). The n·d_m factor (often in mm·rpm, or m/min times the perimeter) is the key indicator of a bearing's SPEED DUTY, and governs several application limits. It sets the operating LIMIT SPEED: each bearing (and each lubrication type) has a maximum n·d_m above which friction heating, centrifugal force on the rolling elements and dynamic effects make operation unfeasible — grease lubrication tolerates lower values, oil higher, and special systems (oil jet, mist) the highest (high-speed bearings, like turbine and machine-tool spindle bearings, reach n·d_m in the millions). The speed factor also influences the bearing type choice (balls take more speed than rollers), the lubricant and the internal clearance (fast bearings may need larger clearance to accommodate thermal expansion). Comparing the application's n·d_m with the bearing limit is an essential check in medium- and high-speed rotating machines. Enter the rotation and the mean diameter.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.