elementary number theory - $n \equiv 5$ (mod $6$) has a prime factor $p$ of $n$ such that $p \equiv 5$ (mod $6$) - Mathematics Stack Exchange
Understanding modulus - Stack Overflow
what is mod?
Modular arithmetic basics - Mathematics Stack Exchange
How much is 17 mod 3?
17 mod 3 equals 2 since dividing 17 by 3 gives a quotient of 5 and a remainder of 2. The remainder is the result of the modulus operation. In simpler terms, 17 mod 3 = 2.
How to calculate modulo division?
To calculate modulo division: subtract the divisor from the dividend until the resultant is less than the divisor.
What are the components of modulo division?
The components of modulo division are dividend, divisor, quotient, and remainder. The remainder is the answer or end result of the operation.
Videos
Your proof is pretty good, though you missed that there are primes congruent to and
mod
(namely,
and
), though we would not have
if
or
divided
.
Your proof is correct but is better phrased as proof of the contrapositive:
If all prime factors of
are congruent to
mod
, then so is
.
The problem with your calculation 5 % 6 is that it will ALWAYS give you remainder 5. If you tried 6 % 5, that will give you 1 for an answer.
This isn't a programming question, as modulus is a mathematical operator not at all unique to Java or any programming language, but 5 mod 6 = 5 as it is the remainder after dividing by 6 (5 < 6 so the remainder is 5). 6 mod 5 = 1, as 6 > 5, so you subtract 5, then you are left with 1 and 1 < 6.
If it helps, here is a pseudocode illustration of modulus (for positive integers):
integer mod(integer a, integer b) {
if a < b:
return a
else:
return mod(a - b, b)
}
Wikipedia doesn't explain it really well. I know it works like a clock, where after 24 it goes back to 1 (20+5=1) but it never explains how to know the "limit" and the only examples are n¹≡n² (mod n³)