GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • Fundamentals & OOPs
  • Data structures and algorithms
  • Aptitude
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 27 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
AptitudeQuantitative aptitude · Numbers and Counting

Number System

Divisibility rules, prime factors, HCF and LCM, remainders, unit digits and trailing zeros, all read from the prime factorisation.

7 min read 45 questions
Practice questions
1234

On this page

1/9
  1. 011. What these questions test
  2. 022. Divisibility rules
  3. 033. Prime factorisation and counting factors
  4. 044. HCF and LCM
  5. 055. Unit digits and remainders of powers
  6. 066. Factorials: trailing zeros and highest powers
  7. 077. Shortcuts and traps
  8. 088. Revision sheet
  9. 09Practice
Back to top

1. What these questions test

Number-system questions ask you to reason about whole numbers without doing the long arithmetic: is this divisible by 9, what is the last digit of a huge power, when do three bells ring together again. Every placement test has a few because they reward method over calculation. Almost all of them rest on one idea: break a number into its prime factors and read the answer off the factors.

A factor (divisor) of n divides n exactly; a multiple of n is n times a whole number. A prime has exactly two factors, 1 and itself (2, 3, 5, 7, 11, …). 1 is not prime, and 2 is the only even prime. Every other number above 1 is composite and can be written as a product of primes in exactly one way.

To test whether a number is prime, try dividing by primes only up to its square root. For 97, √97 is a little under 10, so test 2, 3, 5 and 7. None divides it, so 97 is prime.

2. Divisibility rules

These tests tell you whether a division is exact without doing it. Learn the table; the third column runs each test on one number.

DivisorTestTry it on 5,148
2last digit is evenends in 8: yes
3digit sum divisible by 3digit sum 18: yes
4last two digits divisible by 448 = 4 × 12: yes
5last digit is 0 or 5no
6passes the tests for 2 and 3yes
8last three digits divisible by 8148 = 8 × 18 + 4: no
9digit sum divisible by 9digit sum 18: yes
11(sum of digits in odd places) − (sum in even places) is 0 or a multiple of 11(5 + 4) − (1 + 8) = 0: yes
5148Digit sum 5 + 1 + 4 + 8 = 18, a multiple of 9, so 5,148 is divisible by 9
The digit-sum test for 3 and 9

For a composite divisor, split it into co-prime parts and test each: 12 = 3 × 4, 72 = 8 × 9, 88 = 8 × 11. So 5,148 is divisible by 36 (it passes 4 and 9) and by 99 (9 and 11), but not by 72, because it fails the test for 8. Do not split 12 as 2 × 6: those two share a factor, and 18 passes both tests without being divisible by 12.

3. Prime factorisation and counting factors

Keep dividing by the smallest prime that fits. A factor tree records the work: 360 = 2 × 180 = 2 × 2 × 90 = … = 2³ × 3² × 5.

360218029024531535
Factor tree of 360: the circled leaves are its prime factors

Number of factors. If n = p^a × q^b × r^c, then n has (a + 1)(b + 1)(c + 1) factors, because a factor may take each prime 0, 1, …, up to its full power. For 360 = 2³ × 3² × 5 that is (3 + 1)(2 + 1)(1 + 1) = 24 factors.

  • Odd factors: ignore the 2s. For 360: (2 + 1)(1 + 1) = 6.
  • Even factors: total − odd = 24 − 6 = 18.
  • Perfect-square factors: each prime may take only an even power. For 360: 2 can take power 0 or 2, 3 can take 0 or 2, 5 only 0, so 2 × 2 × 1 = 4.

4. HCF and LCM

The HCF (highest common factor, also called GCD) of two numbers is the largest number dividing both. The LCM (lowest common multiple) is the smallest number both divide. Write each number in primes: the HCF takes the lowest power of each shared prime, the LCM takes the highest power of every prime that appears.

8412622373
84 = 2 × 2 × 3 × 7 and 126 = 2 × 3 × 3 × 7. Overlap: HCF = 2 × 3 × 7 = 42. Everything: LCM = 2 × 2 × 3 × 7 × 3 = 252

The picture also shows why HCF × LCM = product of the two numbers: 42 × 252 = 10584 = 84 × 126. This holds for two numbers only, not three.

Which one does the story want?

The question saysUseAnswer
largest tile / longest tape / greatest number that divides exactlyHCFHCF of the numbers
ring together again / least number divisible by eachLCMLCM of the numbers
least number leaving the same remainder r each timeLCMLCM + r
least number leaving remainders that are each k short of the divisorLCMLCM − k
greatest number leaving the same remainder from several numbersHCFHCF of their differences

Worked example (HCF). The largest square tile that paves a 180 cm by 150 cm floor exactly has side HCF(180, 150) = 30 cm, and 6 × 5 = 30 tiles are needed.

Worked example (LCM). Bells ringing every 8, 12 and 15 seconds ring together every LCM(8, 12, 15) = 120 seconds. The least number that leaves remainder 3 when divided by 4, 5 or 6 is LCM(4, 5, 6) + 3 = 63.

5. Unit digits and remainders of powers

The last digit of a product depends only on the last digits of the numbers multiplied, so the last digits of the powers of any number run in a short repeating cycle.

7¹77²97³37⁴17⁵77⁶97⁷37⁸1last digit of each power
Powers of 7 end in 7, 9, 3, 1 and then repeat: a cycle of length 4
Number ends inLast digits of its powersCycle length
0, 1, 5, 6always the same digit1
44, 62
99, 12
22, 4, 8, 64
33, 9, 7, 14
77, 9, 3, 14
88, 4, 2, 64

Method. Divide the exponent by the cycle length and keep the remainder; a remainder of 0 means the last entry of the cycle. For 7²⁰²⁵: 2025 ÷ 4 leaves 1, so the unit digit is the first entry, 7.

The same trick finds remainders with any divisor. Dividing powers of 2 by 7 leaves 2, 4, 1 and then repeats (because 2³ = 8 = 7 + 1). For 2⁵⁰: 50 ÷ 3 leaves 2, so the remainder is the second entry, 4.

6. Factorials: trailing zeros and highest powers

n! = 1 × 2 × 3 × … × n. A zero at the end comes from a factor 10 = 2 × 5. There are always more 2s than 5s, so count the 5s:

zeros in n! = ⌊n ÷ 5⌋ + ⌊n ÷ 25⌋ + ⌊n ÷ 125⌋ + … (⌊ ⌋ means drop the fraction)

Worked example. 100! ends in ⌊100 ÷ 5⌋ + ⌊100 ÷ 25⌋ = 20 + 4 = 24 zeros. The second term counts the extra 5 hiding in 25, 50, 75 and 100.

The same sum gives the highest power of any prime in n!. The power of 3 in 20! is ⌊20 ÷ 3⌋ + ⌊20 ÷ 9⌋ = 6 + 2 = 8. For a composite such as 12 = 2² × 3, find the powers of 2 and of 3 separately, then see how many complete 12s they can build.

7. Shortcuts and traps

  • Two missing digits: use the rule that involves the fewest unknown digits first (usually 8 or 4, which look only at the end of the number), then the digit-sum rule.
  • a × b is a common multiple, not the LCM, unless a and b share no factor. 6 × 8 = 48 but the LCM is 24.
  • Zero and nine both pass the digit-sum test. If the known digits already add to a multiple of 9, the missing digit can be 0 or 9.
  • Remainder 0 in a cycle means the last entry, not the first.
  • Trailing zeros: stopping at n ÷ 5 undercounts once n reaches 25.
  • "Divisible by a or b": add the two counts and subtract the multiples of the LCM, which were counted twice. Use the LCM, not the product.
  • How many times together: decide whether the starting moment is counted before dividing the time by the LCM.
  • Numbers like 51, 57, 87 and 91 look prime but are 3 × 17, 3 × 19, 3 × 29 and 7 × 13.

8. Revision sheet

NeedFormula or rule
Number of factors of p^a × q^b × r^c(a + 1)(b + 1)(c + 1)
HCFlowest power of each common prime
LCMhighest power of every prime present
Two numbersHCF × LCM = product
Same remainder r with several divisorsLCM + r
Remainders each k short of the divisorLCM − k
Same remainder from several numbersHCF of the differences
Unit digit of aⁿcycle of the last digit; exponent mod cycle length
Zeros at the end of n!⌊n ÷ 5⌋ + ⌊n ÷ 25⌋ + ⌊n ÷ 125⌋ + …
Multiples of k from 1 to N⌊N ÷ k⌋
Divisible by a or b, from 1 to N⌊N ÷ a⌋ + ⌊N ÷ b⌋ − ⌊N ÷ LCM(a, b)⌋

When stuck, factorise. Divisibility, HCF, LCM, number of factors and trailing zeros are all read straight from the prime factorisation.

Practice

45 questions in 3 sets. Every answer comes with its explanation, and each question you get right earns XP.

  • Easy · 15
  • Medium · 15
  • Hard · 15
Start practising
PreviousRaces and GamesNextPermutations and Combinations
Log inStart free