[Tutor] meaning of % in: if n % x == 0:

Steven D'Aprano steve at pearwood.info
Thu Sep 1 02:09:47 CEST 2011

Hugo Arts wrote:

>  n % y == 0 if n is divisible by y. This is useful in factoring prime
> numbers

If you find a way to factor *prime numbers*, you're doing something wrong.


(By definition, a prime number has no factors apart from itself and one, 
which are trivial.)

You mean, factorising numbers into the product of primes.


More information about the Tutor mailing list