PYQ Vault

NDA Maths · Permutation & Combination

Forming Numbers from Digits

Counting how many numbers can be built from given digits under constraints — number of digits, a leading-zero rule, divisibility, or the sum of all such numbers.

Why this matters

Digit problems are permutations dressed in number rules. The two perennial gotchas are the leading-zero exclusion and divisibility tests; the 'sum of all numbers' shortcut saves real time.

Test yourself — a quick 13-question Permutation & Combination recall quiz, instant score.

Concept 1 of 3: Counting numbers with digit constraints

Building an nn-digit number is filling nn ordered slots from the available digits. The one special rule: the leading digit can't be 0, so fill it first from the non-zero digits.

Definition

Fill positions left to right. Distinct digits: first slot has (non-zero choices), each later slot one fewer. Leading-zero rule: if 0 is available, the first digit has one fewer option; equivalently total arrangements minus those starting with 0. Repetition allowed multiplies the per-slot choices.

Worked example

How many 3-digit numbers have all distinct digits from {1,2,3,4}\{1,2,3,4\}?
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Sep 2024 · Q3Easy

Example 1 · Permutation & Combination · Forming Numbers from Digits

How many 4-digit numbers are there having all digits as odd?

Concept 2 of 3: Divisibility constraints

Divisibility fixes specific digits. By 2/5/10 → the units digit; by 4 → the last two digits; by 3/9 → the digit sum. Often the digit sum is fixed (e.g. 1+2+3+4+5=151+2+3+4+5=15), which forces divisibility by 3 for every arrangement.

Definition

  • ÷2: units even. ÷5: units 0 or 5. ÷10: units 0.
  • ÷4: last two digits form a multiple of 4. ÷8: last three.
  • ÷3 / ÷9: digit sum divisible by 3 / 9 (independent of order — so a fixed digit set is all-or-nothing).
  • ÷6: divisible by 2 and 3 together.
  • Counting the multiples of dd in a RANGE [a,b][a,b]: ⌊bd⌋−⌊a−1d⌋\left\lfloor\tfrac bd\right\rfloor-\left\lfloor\tfrac{a-1}{d}\right\rfloor, or last−firstd+1\dfrac{\text{last}-\text{first}}{d}+1 once the first and last multiples are found — 3-digit multiples of 7 run from 105 to 994: 994−1057+1=128\tfrac{994-105}{7}+1=128.

Worked example

How many 3-digit numbers from 1,2,3,4,51,2,3,4,5 (no repeat) are divisible by 5?
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Sep 2025 · Q18Moderate

Example 2 · Permutation & Combination · Forming Numbers from Digits

How many 4-digit numbers that are divisible by 4 can be formed using the digits 1, 2, 3 and 4 (repetition of digits is not allowed)?

Concept 3 of 3: Sum of all numbers formed

By symmetry, each digit lands in each position the same number of times. So the sum of all numbers formed is (sum of digits) × (times each appears per place) × (place-value repunit).

Definition

Using nn distinct digits to form all nn-digit numbers: each digit appears in each place (n−1)!(n-1)! times. Sum =(n−1)!×(sum of digits)×111…1⏟n=(n-1)!\times(\text{sum of digits})\times\underbrace{111\ldots1}_{n}. Adjust the repeat count and place-value string for rr-digit selections. When 0 is one of the digits the symmetry breaks in the LEADING place: 0 cannot lead, so each non-zero digit appears in the leading place (n−1)!(n-1)! times but in every other place only (n−1)!−(n−2)!(n-1)!-(n-2)! times (the arrangements with 0 leading are removed). Compute the leading-place total and the other places separately, or take the all-digits sum above and subtract the sum of the (n−1)(n-1)-digit numbers formed when 0 leads.

Sum of all numbers formed from n distinct digits

Sum=(n−1)!×(sum of digits)×111…1⏟n ones\text{Sum}=(n-1)!\times(\text{sum of digits})\times\underbrace{111\ldots1}_{n\text{ ones}}

Worked example

Find the sum of all 3-digit numbers formed using 3,4,53,4,5 without repetition.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Sep 2018 · Q48Moderate

Example 3 · Permutation & Combination · Forming Numbers from Digits

What is the sum of all three-digit numbers that can be formed using all the digits 3, 4 and 5, when repetition of digits is not\textbf{\text{not}} allowed?

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (1)

  • Sum of all numbers formed

    Sum of all numbers formed from n distinct digits

    Sum=(n−1)!×(sum of digits)×111…1⏟n ones\text{Sum}=(n-1)!\times(\text{sum of digits})\times\underbrace{111\ldots1}_{n\text{ ones}}

Test yourself on Permutation & Combination

20 past NDA questions from this chapter, timed at 25 minutes and marked the way the exam marks it. You see your score and every answer the moment you finish. Free to start.

Related notes