

We can also verify the list from the list of prime numbers above. The process repeats until all the numbers on the list are either encircled or crossed out. As few multiples like 6, 12, 18, 24, 30 … are already crossed out, the remaining ones, like 9, 15, 21, 27, 33, and so on, up to 100, are crossed out now. All the multiples of 3, except 3, are crossed out. The first uncrossed number next to 2, i.e., 3, is encircled.For example, 4, 6, 8, 10, 12, and so on, up to 100 are not prime. All the multiples of 2 except 2 are crossed out as those are not prime numbers.


2 is the only even prime number, and the rest are all odd. Thus there is a total of 25 prime numbers between 1 and 100. For example, 4 is divisible by 1, 2, and 4Ī list of prime numbers from 1 to 100 is provided below for reference: Between 1 and 10 It can be divided evenly by all its factors. For example, 2 is divisible only by 1 and 2. It can be divided evenly only by 1 and the number itself. Difference between Prime and Composite Number Prime Number Similarly, 1 is also not a prime number as it has only one factor (the number 1 itself). Example: Print Prime Numbers // program to print prime numbers between the two numbersĬonst lowerNumber = parseInt(prompt('Enter lower number: ')) Ĭonst higherNumber = parseInt(prompt('Enter higher number: ')) Ĭonsole.Natural numbers greater than 1 that are not prime are known as composite numbers.Ġ is not a prime number, as it has infinite factors. For example, 2, 3, 5, 7, 11 are the first few prime numbers.įor example, 4 is not a prime number because it is divisible by 1, 2 and 4 itself.

A prime number is a positive integer that is only divisible by 1 and itself.
