Placement Prep

Factorials: Permutations, Trailing Zeros, and Placement Examples

Factorial problems appear in every campus aptitude test. This guide covers trailing zeros, permutations, combinations, and solved placement examples.

By FACE Prep Team 5 min read
factorial quantitative-aptitude permutations-and-combinations placement-preparation aptitude-questions campus-placement trailing-zeros number-theory

Trailing zeros, permutations and combinations, and factorial expression simplification form three recurring question types on campus aptitude tests, and all three derive from a single definition.

What a Factorial Is

The factorial of a non-negative integer n, written n!, is the product of every positive integer from 1 through n. A few values to anchor the concept:

  • 1! = 1
  • 2! = 1 × 2 = 2
  • 3! = 1 × 2 × 3 = 6
  • 4! = 1 × 2 × 3 × 4 = 24
  • 5! = 1 × 2 × 3 × 4 × 5 = 120
  • 8! = 40,320
  • 10! = 3,628,800

By convention, 0! equals 1. The justification comes from the recursive definition: (n+1)! = (n+1) × n!. Applying this at n = 0 gives 1! = 1 × 0!, so 0! = 1! / 1 = 1. This convention also makes the combination formula consistent: C(n, 0) = n! / (0! × n!) = 1, which is the right answer: there is exactly one way to select nothing from any set.

The factorial grows extremely fast. 20! already exceeds 2.4 × 10^18, past a 64-bit integer limit. In placement aptitude problems, you rarely need the full value; what matters is its structure: specifically, which primes divide it and how many times.

Trailing Zeros in a Factorial

Every trailing zero in n! comes from a factor of 10, and every factor of 10 requires one factor of 2 paired with one factor of 5. In any factorial, powers of 2 always outnumber powers of 5. The trailing zero count therefore equals the number of times 5 divides into n!.

Legendre’s formula gives the exact power of any prime p in n!:

  • v_p(n!) = floor(n/p) + floor(n/p^2) + floor(n/p^3) + ...

The series terminates when p^k exceeds n. For trailing zeros, set p = 5 and keep dividing until the divisor surpasses n.

Worked Example A: Trailing Zeros in 51!

  • Step 1: floor(51 / 5) = 10
  • Step 2: floor(51 / 25) = 2
  • Step 3: floor(51 / 125) = 0 — stop, 125 > 51
  • Total powers of 5 in 51! = 10 + 2 = 12
  • 51! ends with 12 trailing zeros.

Worked Example B: Trailing Zeros in 100!

  • Step 1: floor(100 / 5) = 20
  • Step 2: floor(100 / 25) = 4
  • Step 3: floor(100 / 125) = 0 — stop
  • Total powers of 5 in 100! = 20 + 4 = 24
  • 100! ends with 24 trailing zeros.

The powers of 2 in 100! total 97, far exceeding 24, confirming that 5 is always the limiting prime for trailing zeros.

Permutations and Combinations

Both formulas are derived in NCERT Class 11 Mathematics, Chapter 7 (Permutations and Combinations), which is the standard curriculum reference in Indian undergraduate programs.

Permutations count ordered arrangements. If you are placing r items chosen from n distinct items and the order matters:

  • P(n, r) = n! / (n - r)!

Combinations count unordered selections. When order does not matter, divide by r! to remove duplicate arrangements:

  • C(n, r) = n! / (r! × (n - r)!)

The deciding question in any aptitude problem: does order matter?

  • Photo line-up (8 people, order matters): P(8, 8) = 8! = 40,320
  • Committee selection (3 from 8, order irrelevant): C(8, 3) = 56

Quick Reference Table

ScenarioFormulaExample
Arrange all n itemsn!5 distinct digits → 5! = 120 unique numbers
Arrange r items from n (ordered)P(n,r) = n! / (n-r)!P(5,2) = 20
Select r items from n (unordered)C(n,r) = n! / (r! × (n-r)!)C(5,2) = 10

Verifying C(5, 2): 5! / (2! × 3!) = 120 / (2 × 6) = 120 / 12 = 10. ✓

For hands-on practice with hundreds of graded P&C problems, IndiaBix Permutations and Combinations is a reliable free resource used widely among campus placement candidates in India.

Mu Sigma’s MuAPT includes data interpretation and counting problems that call for P vs C reasoning. See the Mu Sigma aptitude test guide for the full question pattern breakdown.

Unit Digit of a Factorial

A quick aptitude shortcut: for any n ≥ 5, the unit digit of n! is 0. This is because 5! = 120 already has a factor of 10 (from 2 × 5 in the product). Every factorial above 5! inherits that factor.

nValue of n!Unit digit
111
222
366
4244
51200
67200
75,0400
840,3200
9362,8800

Placement test shortcut: if an expression involves a sum or product of factorials, and all terms have n ≥ 5, the unit digit of the entire expression is 0. Only terms with n ≤ 4 contribute a non-zero unit digit.

For example, the unit digit of 3! + 7! + 4! is determined entirely by 3! + 4! = 6 + 24 = 30, so the unit digit is 0. The 7! term contributes nothing to the unit digit calculation.

Worked Examples

Problem 1: Evaluating a Factorial Expression

  • Q: Evaluate 5! × (6 - 3)!
  • Step 1: 5! = 120
  • Step 2: (6 - 3)! = 3! = 6
  • Step 3: 120 × 6 = 720

Problem 2: Counting Arrangements Without Repetition

  • Q: How many 5-digit numbers can be formed using the digits 1, 2, 5, 7, 8 without repetition?
  • Each digit fills one of the 5 positions exactly once, so the count is P(5, 5) = 5! = 120

Problem 3: Base Representations and Trailing Zeros

This is a higher-level problem seen in data science and analytics aptitude tests.

  • Q: n! ends with 10 zeros in base 6 and 7 zeros in base 8. Find the smallest such n.
  • Trailing zeros in base 6 (= 2 × 3) equals min(v₂(n!), v₃(n!)); we need this to equal 10.
  • Trailing zeros in base 8 (= 2³) equals floor(v₂(n!) / 3); we need this to equal 7, so 21 ≤ v₂(n!) ≤ 23.
  • For n = 24: v₃(24!) = floor(24/3) + floor(24/9) + floor(24/27) = 8 + 2 + 0 = 10 ✓
  • For n = 24: v₂(24!) = floor(24/2) + floor(24/4) + floor(24/8) + floor(24/16) = 12 + 6 + 3 + 1 = 22 ✓
  • Check: min(22, 10) = 10 ✓ and floor(22 / 3) = 7 ✓
  • Verify n = 23 fails: v₂(23!) = 11 + 5 + 2 + 1 = 19; floor(19 / 3) = 6, not 7, so the base-8 condition fails.
  • Answer: n = 24

For a full breakdown of the aptitude test formats where these question patterns appear, the campus placement evaluation test guide and the time and work aptitude guide cover the broader quantitative aptitude content tested in placement rounds.


The P(n,r) and C(n,r) formulas that make these placement problems tractable also describe how language models narrow down their next-token choices. Permutations determine how many ordered token sequences are possible from a vocabulary; sampling methods (top-k, temperature scaling) collapse that space to a manageable selection at each generation step. TinkerLLM lets you experiment with those sampling parameters directly, at ₹299, with no cohort wait and no prerequisites.

Primary sources

Frequently asked questions

What is 0! and why does it equal 1?

By convention, 0! equals 1. The clearest justification uses the recursive definition: (n+1)! = (n+1) times n!. Setting n = 0 gives 1! = 1 times 0!, so 0! = 1!/1 = 1. This also makes the combination formula work correctly: C(n,0) = n! / (0! times n!) = 1, which is correct — there is exactly one way to choose nothing from a set.

How do I calculate trailing zeros in 100 factorial quickly?

Apply Legendre's formula for the prime 5: floor(100/5) + floor(100/25) + floor(100/125) = 20 + 4 + 0 = 24 trailing zeros. You count powers of 5, not powers of 2, because there are always more factors of 2 than 5 in any factorial.

What is the difference between permutations P(n,r) and combinations C(n,r)?

Permutations count ordered arrangements: P(n,r) = n! / (n-r)!. Combinations count unordered selections: C(n,r) = n! / (r! times (n-r)!). For example, choosing 2 items from 5 in order gives P(5,2) = 20 ordered pairs, but as unordered pairs C(5,2) = 10. If the problem says arrange or asks for seating arrangements, use P. If it says select or choose a committee, use C.

For which campus placement tests do factorial and P&C questions appear?

Permutations, combinations, and trailing-zeros questions appear in the quantitative aptitude sections of TCS NQT, AMCAT, CoCubes, and company-specific tests like Mu Sigma MuAPT. One to three questions from this topic is typical in a standard aptitude screening round.

What is the unit digit of 15 factorial?

The unit digit of 15 factorial is 0. Any n factorial for n greater than or equal to 5 ends in 0, because the product always contains both 2 and 5 as factors, making it divisible by 10. For quick aptitude answers: if the question asks for the unit digit of any n factorial where n is 5 or greater, the answer is 0.

Build AI projects

A self-paced playground for building with LLMs.

TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.

Try TinkerLLM (₹299 launch)
Free AI Roadmap PDF