Yes. 13 is only divisible by 1 and itself.
A prime number is an integer 2 or greater that not a multiple of any smaller integer (other than 1).
You likely encountered prime number in discrete math, if not many other places.
Prime numbers are extremely important in cryptography.
The class BigInteger
has several methods that involve them.
For example, 13 is a prime number because it is not a multiple of
any of the integers 2 through 12.
Another way of saying this is 13 % m
is not zero for m
from 2 to 12.
An integer that is not prime is composite. It is the product of at least two other integers.
For example, 12 is composite because it is the product of 3 and 4.
(Algorithm Design: ) Say you are given an integer. What is the simplest way to decide if it is prime?