TExcelTAD
Home › Basic Math & Pre-Algebra › Factors and Multiples

Factors and Multiples

A factor of a number divides it exactly, with no remainder; a multiple of a number is what you get by multiplying it by a whole number. 4 is a factor of 12, and 12 is a multiple of 4. These two words describe the same relationship from opposite ends, and they are the starting point for primes, fractions and the GCF and LCM.

Factors

The factors of 12 are 1, 2, 3, 4, 6 and 12, because each one divides 12 with remainder 0. In Python, "dd is a factor of nn" is the test n % d == 0.

Factors come in pairs that multiply to the number:

12=1×12=2×6=3×4\begin{aligned} 12 &= 1 \times 12 \\ &= 2 \times 6 \\ &= 3 \times 4 \end{aligned}

Arrange 12 counters in a rectangle and these pairs are exactly the possible rectangles: 1 by 12, 2 by 6, 3 by 4.

The pairs give a fast way to find every factor. Test divisors starting from 1, and each time one works, write down its partner too. You can stop once the divisor passes the square root, because after that you only meet partners you already have. For 36, 36=6\sqrt{36} = 6, so you only test 1 to 6:

1×36, 2×18, 3×12, 4×9, 6×6(5 doesn’t divide 36)factors of 36: 1,2,3,4,6,9,12,18,36\begin{aligned} &1 \times 36,\ 2 \times 18,\ 3 \times 12,\ 4 \times 9,\ 6 \times 6 \qquad \text{(5 doesn't divide 36)} \\ &\text{factors of 36: } 1, 2, 3, 4, 6, 9, 12, 18, 36 \end{aligned}

When the number is a perfect square, the middle pair repeats (6×66 \times 6), so a square number has an odd count of factors. Every other number has an even count.

python · try it yourself
import math

def factors(n):
    small, large = [], []
    for d in range(1, math.isqrt(n) + 1):     # isqrt = whole-number square root
        if n % d == 0:
            small.append(d)
            if d != n // d:
                large.append(n // d)
    return small + large[::-1]

for n in [12, 36, 97, 100]:
    f = factors(n)
    print(f"{n}: {f}  ({len(f)} factors)")
12: [1, 2, 3, 4, 6, 12]  (6 factors)
36: [1, 2, 3, 4, 6, 9, 12, 18, 36]  (9 factors)
97: [1, 97]  (2 factors)
100: [1, 2, 4, 5, 10, 20, 25, 50, 100]  (9 factors)

97 has only two factors, 1 and itself: it is a prime. You will study primes in Primes and Prime Factorization.

The square-root shortcut matters. To factor a number around one million, the slow method tests a million divisors; this one tests about a thousand.

Facts about factors

  • 1 is a factor of every number, and every number is a factor of itself.
  • Every factor of nn (other than nn) is at most n÷2n \div 2.
  • If dd is a factor of nn, then dd is a factor of every multiple of nn. (3 divides 12, so 3 divides 24, 36, 120, …)
  • If dd is a factor of both aa and bb, it is a factor of a+ba + b and a−ba - b. (3 divides 12 and 21, so it divides 33 and 9.)

Multiples

The multiples of 4 are 4, 8, 12, 16, 20, … : 4×14 \times 1, 4×24 \times 2, 4×34 \times 3, and so on forever. A number has finitely many factors but infinitely many multiples. (0 is also a multiple of every number, 4×04 \times 0, but usually we list the positive ones.)

Python's range with a step lists multiples directly, and n % k == 0 tests whether nn is a multiple of kk:

python · try it yourself
print("multiples of 4:", list(range(4, 41, 4)))
print("multiples of 6:", list(range(6, 61, 6)))
common = [m for m in range(1, 61) if m % 4 == 0 and m % 6 == 0]
print("common multiples of 4 and 6 up to 60:", common)
print("is 1000 a multiple of 8?", 1000 % 8 == 0)
multiples of 4: [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
multiples of 6: [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]
common multiples of 4 and 6 up to 60: [12, 24, 36, 48, 60]
is 1000 a multiple of 8? True

The smallest common multiple, 12, is the least common multiple, the star of the GCF and LCM lesson.

Perfect numbers: a curiosity

Add up the factors of 6 that are smaller than 6: 1+2+3=61 + 2 + 3 = 6. A number equal to the sum of its smaller factors is called perfect. They are rare:

python · try it yourself
def proper_factor_sum(n):
    return sum(d for d in range(1, n // 2 + 1) if n % d == 0)

print([n for n in range(2, 10000) if proper_factor_sum(n) == n])
[6, 28, 496, 8128]

Only four below 10 000. Nobody knows whether an odd perfect number exists; it is one of the oldest open questions in mathematics.

In software

  • Layouts: to arrange 24 thumbnails in a neat rectangle, pick a factor pair: 4×64 \times 6, 3×83 \times 8, 2×122 \times 12. A 1920×10801920 \times 1080 screen splits evenly into tiles whose size is a common factor of both.
  • "Every nn-th time": a game might autosave every 300 frames or spawn an enemy every 7th wave: if frame % 300 == 0. That is a test for a multiple.
  • Memory alignment: processors read data fastest when its address is a multiple of 4, 8 or 16, so compilers pad structures to multiples of these sizes.
  • Trial division (testing factors up to n\sqrt{n}) is the simplest way to test primes, and it shows why large numbers are hard to factor, which cryptography relies on.

Exercises

Exercise 1: List the factors

List all factors of 48 using factor pairs.

Answer

1, 2, 3, 4, 6, 8, 12, 16, 24, 48

Solution

48≈6.9\sqrt{48} \approx 6.9, so test 1 to 6:

1×48, 2×24, 3×16, 4×12, 6×8(5 does not divide 48)1 \times 48,\ 2 \times 24,\ 3 \times 16,\ 4 \times 12,\ 6 \times 8 \qquad \text{(5 does not divide 48)}

Read the small partners up, then the large ones down.

Exercise 2: Factor or multiple?

True or false: (a) 7 is a factor of 91 (b) 45 is a multiple of 6 (c) 1 is a multiple of 1 (d) 16 is a factor of 4

Answer

(a) true (b) false (c) true (d) false

Solution

(a) 91=7×1391 = 7 \times 13. (b) 45÷6=745 \div 6 = 7 remainder 3. (c) 1=1×11 = 1 \times 1. (d) 4÷164 \div 16 is not a whole number; it is the other way round, 4 is a factor of 16.

Exercise 3: Rectangles of chairs

In how many different ways can 60 chairs be arranged in a rectangle with at least 2 rows and at least 2 chairs per row? (A 5×125 \times 12 and a 12×512 \times 5 arrangement count as different.)

Answer

10 ways

Solution

60 has 12 factors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60. The number of rows must be a factor of 60, other than 1 (one row) and 60 (one chair per row). That leaves 10 choices of row count.

python · try it yourself
rows = [r for r in range(2, 60) if 60 % r == 0]
print(rows, len(rows))
[2, 3, 4, 5, 6, 10, 12, 15, 20, 30] 10

Exercise 4: Most factors

Which number from 1 to 100 has the most factors? Use the factors function from this lesson.

Answer

60, 72, 84, 90 and 96 tie with 12 factors each.

Solution
python · try it yourself
import math

def factors(n):
    small, large = [], []
    for d in range(1, math.isqrt(n) + 1):
        if n % d == 0:
            small.append(d)
            if d != n // d:
                large.append(n // d)
    return small + large[::-1]

counts = {n: len(factors(n)) for n in range(1, 101)}
best = max(counts.values())
print(best, [n for n, c in counts.items() if c == best])
12 [60, 72, 84, 90, 96]

Numbers built from many small primes (60=2×2×3×560 = 2 \times 2 \times 3 \times 5) have the most factors, which is why 60 minutes and 360 degrees are so convenient to divide up.

Test yourself

Which of these is NOT a factor of 54?

  1. 6
  2. 9
  3. 12
  4. 27

To find all factors of 400 with factor pairs, up to which divisor do you need to test?

  1. 200
  2. 100
  3. 40
  4. 20

Which number has an odd number of factors?

  1. 18
  2. 25
  3. 30
  4. 50