Divisibility

Divisibility

Introduction

  • Divisibility is a property of a pair of numbers.
  • Given two numbers: d and n, we can say d divides n if there is a third number k in which dk = n
  • This property also goes by other names:
    • n is a multiple of d
    • d is a factor or divisor of n
    • n is the dividend
  • if d divides n then we write it as:
    LaTeX:d \mid n
  • if d does not divide n then we write it as:
    LaTeX:d \nmid n

Example

  • Given the two numbers: 7 and 42, we can say that 7 divides 42 because there is third number: 6 which forms the equality 6 * 7 = 42
  • This can be written as:

code (Python)

def is_divisible(divisor, dividend):
    return dividend % divisor == 0


print(is_divisible(7, 42))  # prints True

print(is_divisible(4, 42))  # prints False