Math Fundamentals18 sections · 814 units
Open in Course

What is Divisibility

(When division leaves no remainder)

We say a divides b if you can write b = a × k for some integer k. The division leaves no remainder.

Example: 3 divides 12 because 12 = 3 × 4. Here k = 4. But 3 does not divide 13 because 13 = 3 × 4 + 1. There is a remainder of 1.

In code, you check this with the modulo operator: if b % a == 0, then a divides b.