Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 86 ยท Number System

Number Types and Divisibility Rules

Learn natural numbers, integers, rationals and primes, then master divisibility rules for 2 to 13 with worked examples and a runnable tester.

The number system chapter is the foundation of quantitative aptitude. Questions about HCF, remainders, digits and divisors all rest on a few ideas: what kind of number you are dealing with, which primes it is made of, and whether it divides evenly by something. Being able to tell at a glance that 4,368 is divisible by 6, 7 and 13 without dividing is exactly the kind of skill these tests reward.

In this lesson you will classify numbers, learn what primes are and how to test for them, and learn the divisibility rules for 2 through 13. A script at the end checks every rule against real division, so you can see that the rules are exact, not rules of thumb.

Kinds of numbers

Numbers are grouped in nested families.

  • Natural numbers are the counting numbers 1, 2, 3, โ€ฆ (some books start at 0, but aptitude tests almost always start at 1).
  • Whole numbers are the natural numbers together with 0.
  • Integers add the negatives: โ€ฆ, โˆ’2, โˆ’1, 0, 1, 2, โ€ฆ.
  • Rational numbers are numbers that can be written as a fraction p/q of two integers with q โ‰  0. So 3/4, โˆ’5, 0.25 and 0.333โ€ฆ are all rational. A decimal is rational exactly when it ends or repeats.
  • Irrational numbers cannot be written as such a fraction. โˆš2 and ฯ€ are examples; their decimals never end and never repeat.
  • Real numbers are all of the above together.
flowchart TB
    R["Real numbers"] --> Q["Rational numbers"]
    R --> I["Irrational numbers"]
    Q --> Z["Integers"]
    Z --> W["Whole numbers"]
    W --> N["Natural numbers"]

Each family on the rational side sits inside the one above it; irrational numbers are the part of the reals left over.

Some words you will meet constantly: even numbers are multiples of 2, odd numbers are not. A factor (or divisor) of n divides n exactly, and a multiple of n is n times an integer. Two numbers are co-prime when their only common factor is 1: 8 and 15 are co-prime even though neither is prime.

Prime and composite numbers

A prime number has exactly two factors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47. Two facts trip people up:

  • 1 is neither prime nor composite, because it has only one factor.
  • 2 is the only even prime. Every other even number is divisible by 2 and therefore composite.

A composite number has more than two factors, for example 12 or 91.

Testing whether a number is prime

To test n, you only need to try primes up to โˆšn. If none divides n, then n is prime. Why? If n = a ร— b with both factors larger than โˆšn, the product would exceed n, so at least one factor is at most โˆšn.

Example: is 247 prime? โˆš247 is a bit under 16, so try 2, 3, 5, 7, 11, 13. The digit sum is 13, so 3 fails; it does not end in 0, 2, 4, 5, 6 or 8. 7 ร— 35 = 245, so 7 leaves remainder 2. 11: alternating sum 2 โˆ’ 4 + 7 = 5, no. 13 ร— 19 = 247. So 247 = 13 ร— 19, composite. A common trap is assuming that numbers like 91 (7 ร— 13) or 221 (13 ร— 17) are prime because they "look" prime.

Divisibility rules

A divisibility rule gives you a quick test using only the digits. Here are the rules for 2 to 13.

Divisor Rule Example
2 Last digit is 0, 2, 4, 6 or 8 1,358
3 Sum of digits divisible by 3 4,821: 4+8+2+1 = 15
4 Last two digits divisible by 4 7,316: 16
5 Last digit is 0 or 5 2,845
6 Divisible by both 2 and 3 5,274
7 Double the last digit and subtract it from the rest; repeat; result divisible by 7 (including 0) 483: 48 โˆ’ 6 = 42
8 Last three digits divisible by 8 9,128: 128
9 Sum of digits divisible by 9 6,237: 18
10 Last digit is 0 1,430
11 Alternating digit sum (from the right) is 0 or a multiple of 11 2,816: 6 โˆ’ 1 + 8 โˆ’ 2 = 11
12 Divisible by both 3 and 4 7,236
13 Add 4 times the last digit to the rest; repeat; result divisible by 13 2,951: 295 + 4 = 299; 29 + 36 = 65

Why the rules work

The idea behind 3 and 9 is that 10 leaves remainder 1 when divided by 9 (and by 3). So every power of 10 does too, and a number leaves the same remainder as its digit sum. For 11, 10 leaves remainder โˆ’1, so powers of 10 alternate between 1 and โˆ’1, which is why digits get alternating signs. For 4 and 8, 100 is a multiple of 4 and 1,000 is a multiple of 8, so only the end of the number matters.

Composite divisors: combine co-prime rules

For a composite divisor such as 6, 12, 15, 18 or 24, check two co-prime factors. 6 = 2 ร— 3, so test 2 and 3. 12 = 3 ร— 4 (co-prime), so test 3 and 4. Do not test 2 and 6 for 12, or 4 and 6, because those pairs share a factor and the combination does not prove divisibility. For example, 6 is divisible by 2 and by 6 but not by 12.

A full example

Is 4,368 divisible by 2, 3, 4, 6, 7, 8, 9, 11, 12 and 13?

  • 2: last digit 8, yes. 3: digits sum to 21, yes. 4: 68 รท 4 = 17, yes. 6: yes (2 and 3). 8: 368 รท 8 = 46, yes.
  • 9: digit sum 21, not divisible by 9, no. 12: 3 and 4, yes.
  • 7: 436 โˆ’ 16 = 420; 42 โˆ’ 0 = 42, divisible by 7, yes.
  • 11: alternating sum 8 โˆ’ 6 + 3 โˆ’ 4 = 1, no.
  • 13: 436 + 32 = 468; 46 + 32 = 78, which is 13 ร— 6, yes.

So 4,368 = 2โด ร— 3 ร— 7 ร— 13.

Test the rules with code

The tester below implements each rule using only digits, then compares the result with a real remainder test over the numbers from 1 to 20,000.

JS Divisibility rule tester

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Every line should say "matches". The last line lists the divisors for 4,368, confirming the worked example above. Change test to try your own number.

Primes up to 100

A useful speed fact: there are 25 primes below 100. The sieve of Eratosthenes finds them by crossing out multiples of 2, 3, 5 and 7 (the primes up to โˆš100 = 10). Whatever is left (apart from 1) is prime. Run it below and compare with your memory.

JS Sieve of Eratosthenes

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Useful consequences

  • The product of any two consecutive integers is even. The product of three consecutive integers is divisible by 6.
  • A number is divisible by 10 only when it is divisible by both 2 and 5.
  • If a number divides two numbers, it divides their sum and difference. This idea is the basis of the Euclidean method in HCF and LCM.
  • Some quick missing-digit questions use these rules: "If 5_4 is divisible by 9, find the digit" gives 5 + x + 4 divisible by 9, so x = 0 or 9.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which of the following is a prime number?

    91 = 7 x 13, 87 = 3 x 29, and 93 = 3 x 31. 89 has no prime factor up to 9 (2, 3, 5, 7 all fail), so it is prime.
  2. 2. For what digit x is the number 4x72 divisible by 9?

    The digit sum is 4 + x + 7 + 2 = 13 + x. The next multiple of 9 is 18, so x = 5.
  3. 3. Is 7,436 divisible by 11?

    From the right: 6 - 3 + 4 - 7 = 0, which is a multiple of 11. Indeed 7,436 = 11 x 676.
  4. 4. A number is divisible by 12 if it is divisible by which pair?

    3 and 4 are co-prime and multiply to 12. The other pairs share a factor of 2 and do not guarantee divisibility by 12.
  5. 5. Which statement is true?

    Every even number greater than 2 is divisible by 2, so 2 is the only even prime. 1 is not prime, and 9 is a counterexample to the third claim.

Summary

  • Natural numbers sit inside whole numbers, which sit inside integers, rationals and reals; irrationals fill the rest of the reals.
  • A prime has exactly two factors. 1 is not prime and 2 is the only even prime.
  • To test primality, try primes up to the square root.
  • Divisibility rules exist for 2 to 13; rules for 3, 9 and 11 come from remainders of powers of 10.
  • For composite divisors, test co-prime factors (3 and 4 for 12, not 2 and 6).
  • The sieve of Eratosthenes finds all primes up to a limit.

Next: Factors, Multiples and Counting Divisors, where prime factorization lets you count and add up divisors in seconds.