Sumwise

Factorial of 338

338! = 44255287802392079480567354536936433828166468838179226131761740792973391209872334107349786334848602281974240948820577640171211078747992169308523006102856055721606813693726226454463150622185830995929496887850895986165462521267774799330708302059711265069664291028714201486924803213511792780084165466261334528965813325261918505888417719179251614950394678219618596877017764639730311805590764514988031421342028599917350889021234936821628277097349506378671759044702109908957361026051023863216965299484245742578946819439787040593334948847656172526177038949677297074754796860038682206559619740722039957784689197718731722650943391698780160000000000000000000000000000000000000000000000000000000000000000000000000000000000

710 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

338! = 338 × 337 × … × 2 × 1 = 4425528780239207948056735453693643382816…

Facts about 338!

Digits710
Trailing zeros82 (one for every factor 5 × 2)
Stirling estimate≈ Infinity
338! ÷ 337!338

Nearby factorials

336!388524641391955467495718… (705 digits)
337!130932804149088992546057… (708 digits)
339!150025425650109149439123… (713 digits)
340!510086447210371108093019… (715 digits)

What are factorials used for?

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

Counting with 338!

There are 4.4255 × 10^709 different ways to arrange 338 different books on a shelf: 338 choices for the first place, 337 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 338 runners, there are 338 × 337 × 336 = 38,272,416 possible podiums. If the order does not matter, divide by 3! = 6 to get 6,378,736 ways to choose a group of three. Choosing a pair from 338 people can be done in 56,953 ways.

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

How big is 338!?

338! has 710 digits, so it is larger than the estimated number of atoms in the observable universe (about 10^80). The digits add up to 2925, 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 338!

Every prime up to 338 divides 338!. Legendre's formula counts how often: add ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + … for each prime p. For 338! that gives 2^334 × 3^166 × 5^82 × 7^54 × 11^32 × 13^28 × 17^20 × 19^17 × 23^14 × 29^11 × … (68 primes in all). The 82 trailing zeros come from pairing the 82 factors of 5 with factors of 2.

Shuffles where nothing stays put

A related count is the number of derangements of 338 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 338! ÷ e, so about 36.8% of all 4.4255 × 10^709 orders are derangements. From about four items on, that share stays close to 1 ÷ e, roughly 37%, however many items there are.

Computing 338! yourself

In Excel or Google Sheets, type =FACT(338). 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(338) returns the exact integer with all 710 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 338 factorial?

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

How many digits does 338! have?

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

How many zeros are at the end of 338!?

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

Is 338! divisible by 339?

Yes. 339 is not prime, so its factors already appear among the numbers 1 to 338.

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

6. Strip the 82 trailing zeros and look at the digit that is left at the end.

What is 339! in terms of 338!?

339! = 339 × 338!. Each factorial is the previous one multiplied by the next whole number.