Sumwise

Factorial of 400

400! = 64034522846623895262347970319503005850702583026002959458684445942802397169186831436278478647463264676294350575035856810848298162883517435228961988646802997937341654150838162426461942352307046244325015114448670890662773914918117331955996440709549671345290477020322434911210797593280795101545372667251627877890009349763765710326350331533965349868386831339352024373788157786791506311858702618270169819740062983025308591298346162272304558339520759611505302236086810433297255194852674432232438669948422404232599805551610635942376961399231917134063858996537970147827206606320217379472010321356624613809077942304597360699567595836096158715129913822286578579549361617654480453222007825818400848436415591229454275384803558374518022675900061399560145595206127211192918105032491008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

869 digits

Sumwise · Maintained by Theo Abbott (pen name) · automated checks · Data: exact arithmetic; unit definitions from NIST SP 811 · Updated · How the checks work

How it is calculated

400! = 400 × 399 × … × 2 × 1 = 6403452284662389526234797031950300585070…

Facts about 400!

Digits869
Trailing zeros99 (one for every factor 5 × 2)
Stirling estimate≈ Infinity
400! ÷ 399!400

Nearby factorials

398!401218814828470521693909… (864 digits)
399!160086307116559738155869… (867 digits)
401!256778436614961820002015… (872 digits)
402!103224931519214651640810… (875 digits)

What are factorials used for?

Counting arrangements: 400! is the number of different orders in which 400 distinct items can be lined up. Factorials also appear in probability, combinations and series.

Counting with 400!

There are 6.4034 × 10^868 different ways to arrange 400 different books on a shelf: 400 choices for the first place, 399 for the second, and so on down to one choice for the last. If you only fill the first three places, as with gold, silver and bronze among 400 runners, there are 400 × 399 × 398 = 63,520,800 possible podiums. If the order does not matter, divide by 3! = 6 to get 10,586,800 ways to choose a group of three. Choosing a pair from 400 people can be done in 79,800 ways.

In probability, if 400 names are drawn out of a hat one at a time, the chance of drawing them in one particular order is 1 in 6.4034 × 10^868. That is why shuffled decks and passwords with many symbols are so hard to guess.

How big is 400!?

400! has 869 digits, so it is larger than the estimated number of atoms in the observable universe (about 10^80). The digits add up to 3402, a multiple of 9, as they are for every factorial from 6! on. Stirling's formula, √(2πn) × (n/e)^n, gives a close estimate without multiplying everything out, and gets more accurate as n grows.

Prime factors of 400!

Every prime up to 400 divides 400!. Legendre's formula counts how often: add ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + … for each prime p. For 400! that gives 2^397 × 3^196 × 5^99 × 7^66 × 11^39 × 13^32 × 17^24 × 19^22 × 23^17 × 29^13 × … (78 primes in all). The 99 trailing zeros come from pairing the 99 factors of 5 with factors of 2.

Shuffles where nothing stays put

A related count is the number of derangements of 400 items: orders in which no item ends up in its original place, as in a Secret Santa where nobody draws their own name. The count is the whole number nearest to 400! ÷ e, so about 36.8% of all 6.4034 × 10^868 orders are derangements. From about four items on, that share stays close to 1 ÷ e, roughly 37%, however many items there are.

Computing 400! yourself

In Excel or Google Sheets, type =FACT(400). Spreadsheets keep only 15 significant digits, so from 18! on the result is rounded, and FACT stops at 170!, the largest factorial that fits in a standard floating-point number. In Python, math.factorial(400) returns the exact integer with all 869 digits, because Python integers have no size limit. The gamma function extends factorials to fractions: Γ(n + 1) = n!, so (1/2)! = √π ÷ 2 ≈ 0.8862.

Why is 0! equal to 1?

There is exactly one way to arrange nothing, and the rule n! = n × (n − 1)! only works for n = 1 if 0! = 1. Defining it this way keeps formulas for combinations and series correct at the edges.

Calculate another factorial

How answers are calculated and checked: methodology.

Questions

What is 400 factorial?

400! is the product of every whole number from 1 to 400.

How many digits does 400! have?

869. The number of digits of n! is the whole part of log10(n!) plus one.

How many zeros are at the end of 400!?

99. Count the factors of 5 in the numbers 1 to 400: there are always more factors of 2, so every 5 makes one trailing zero.

Is 400! divisible by 401?

No. 401 is prime and bigger than every factor of 400!, so it cannot divide it (Wilson's theorem says 400! leaves a remainder of 400 when divided by 401).

What is the last non-zero digit of 400!?

8. Strip the 99 trailing zeros and look at the digit that is left at the end.

What is 401! in terms of 400!?

401! = 401 × 400!. Each factorial is the previous one multiplied by the next whole number.