## Lesson goal: Testing divisibility

Previous: Fermat's Last Theorem | Home | Next: Introduction

In a previous lesson, you used the % (or mod) operator to find the remainder one gets when two numbers are divided, say like a % b. If a remainder is ever zero, it means that b divides evenly into a, or a is divisible by b.

Try this (from Salkind, 1966): Use a for-loop and an if-statement to find the number of positive integers less than 1000 that are NOT divisible by either 5 or 7. To count, a number must not be simultaneously divisible by either 5 or 7.